Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6846233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:35:47+00:00 2026-05-27T00:35:47+00:00

I want to use a form that has two submit buttons. Each button calls

  • 0

I want to use a form that has two submit buttons. Each button calls the same form action, but submits a different value for one of its fields. To do this, I have been successful using the s:submit button as follows:

<s:submit name="submitType" value="foo" type="button">Click me!</s:submit>

In the above, the text that appears in the button (“Click me!”) is different from the value that gets submitted by the form (“foo”). However, this is not the case for the dojo submit tag with the exact same attributes:

<sx:submit name="submitType" value="bar" type="button">Or click me!</sx:submit>

With the above tag, the button’s text is “bar” and the words “Or click me!” appear beside it.

For good measure, I’ll throw in the HTML that gets generated by each of these buttons:

<!-- (Using the simple form theme) -->
<!-- The s:submit tag: -->
<button type="submit" id="submit-sandbox_submitType" name="submitType"
    value="foo">
    Click me!
</button>

<!-- The sx:submit tag -->
<input type="button" dojoType="struts:Bind" events="onclick"
    id="widget_1100841481" label="bar" name="submitType" value="bar" />
<script language="JavaScript" type="text/javascript">
    djConfig.searchIds.push("widget_1100841481");
</script>
Or click me!

It seems that the sx:submit button’s type attribute isn’t working as it is described in the documentation! 🙁 Any thoughts?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T00:35:48+00:00Added an answer on May 27, 2026 at 12:35 am

    I found an answer to my own question in the Struts 2 cookbook. When you use multiple submit buttons to input submit different field values, a recommended approach is to use a separate boolean field for each submit button instead of a single String field for all of the submit buttons. This way, the value attribute of the button doesn’t matter as far as what gets submitted to the action, so I can use it to display whatever text I want.

    http://struts.apache.org/2.2.3/docs/multiple-submit-buttons.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have two text inputs like the following, i don't want to use <form>
I have a form that consists of two data grids and a button. Datagrid
I want to use XMLHttpRequest in JavaScript to POST a form that includes a
I want to use the jQuery accordion tool for a form i'm building so
i want to use facebook's fb:dialog tag to display a simple pop-up form for
the company I work for want to use a hosted payment form to charge
I have this easy little form in my JavaFX application. I want to use
I have a transaction log file in CSV format that I want use to
I has a jsp page (index.jsp) with a form with two text fileds username
I have a search form field that I want to compare with multiple columns

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.