You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Hubert Rabago <hr...@gmail.com> on 2007/04/26 16:51:44 UTC

Re: Form submission

There are differences in how a user interacts with html:button and
html:submit.  For instance, pressing enter on some fields can trigger
a submit button, but not a regular button.  You can get the best of
both worlds letting your javascript method determine whether the
submit should happen at all but still letting your submit button
actually submit the form:

<html:submit onclick="return populateAndSubmit()" />

function populateAndSubmit() {
     if (goAheadCondition) {
         // don't call document.ChallengeQuestionForm.submit() here
         // let the submit button do the submit
         return true;
     } else {
         // tell the submit button not to proceed
         return false;
     }
}



On 4/26/07, Krishna, Hari (FTT-CInternet) <HK...@templeton.com> wrote:
> THANKS DUDE It works now
>
> -----Original Message-----
> From: pushkar.p@netsol.co.in [mailto:pushkar.p@netsol.co.in]
> Sent: Thursday, April 26, 2007 11:24 AM
> To: user@struts.apache.org
> Subject: RE: Form submission
>
> You can try replacing the html:submit with html:button and call your
> populateAndSubmit() method from the button.
>
>
> -Pushkar.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org