Rob,

here's an message I sent a few days ago. It relies on Javascript which isn't
optimal... but it does the job.

Andrej

<START COPY-AND-PASTE>

Why don't you separate the value displayed from the action sent using a
Javascript method:

<script language="javascript">
function submitWithAction(action) {
  document.yourFormName.action.value=action;
}
</script>

<input type="hidden" name="action"> (this can be generated with
<html:hidden>)
<html:submit Onclick="submitWithAction('Create');">
  <bean:message key="create" />
</html:submit>
<html:submit Onclick="submitWithAction('Search');">
  <bean:message key="search" />
</html:submit>

Your buttons will be multi-language and the value of your hidden "action"
parameter will be a constant that you can reuse (and that is not tied to a
language).

Just my 2 cents...

Andrej
<END COPY-AND-PASTE>

-----Original Message-----
From: Rob Breeds [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 13, 2001 2:19 PM
To: Struts Users Mailing List
Subject: Re: multiple html:submit buttons with different names?



Brian

That would work but what if the text on the button was multilingual, ie
could be any one of 100 languages depending on user locale setting, which
is what I have to support!

Rob



 

                    Brian Dainton

                    <daintons@yaho       To:     Struts Users Mailing List
<[EMAIL PROTECTED]>                                        
                    o.com>               cc:

                                         Subject:     Re: multiple
html:submit buttons with different names?

                    13/11/2001

                    19:12

                    Please respond

                    to "Struts

                    Users Mailing

                    List"

 

 





Rob,

Assuming your FormBean has a getter/setter for "action":

<td height="22" align="right">
              <html:submit  property="action" value="Submit"/>
            </td>
            <td height="22">
              <html:submit  property="action" value="Close"/>
</td>

Within the action,  you could then assign the forward based on the value of
'action'

MyFormBean form1 = (MyFormBean) form;
String sAction = form1.getAction();

if (sAction.equals("Submit"))

....

Brian

--- Rob Breeds <[EMAIL PROTECTED]> wrote:
> Hi
>
> Is it possible to have multiple <html:submit> tags in a  <html:form>
> different only in name such that the action can differentiate between
them.
>
> The docs indicate there is no 'name' attribute for the <html:submit> tag
> corresponding to the name attribute for a HTML input type="submit" tag.
>
> Ultimately I want one form on the page, with several ways of submitting
the
> form depending on which section I'm in, and then have the final submit
> button indicate to the Action class that the form is complete.
>
> Any ideas please?
>
> Thanks
>
> Rob
>
>
>
>
> --
> To unsubscribe, e-mail:   <
mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <
mailto:[EMAIL PROTECTED]>
>


__________________________________________________
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com

--
To unsubscribe, e-mail:   <
mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <
mailto:[EMAIL PROTECTED]>





--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

Reply via email to