struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Saul Q Yuan" <y...@dataanvil.com>
Subject Re: How to perform validation and then call another javascript function?
Date Tue, 30 Dec 2003 00:24:17 GMT
I think you can define a new Javascript function, and call the
validateSubscriptionForm(this) first in the new function, and inside
onsubmit call this new function instead. Something like the following:

newFunction(form) {
  validate = validateSubscriptionForm(form);

  if(!validate)
    return false;

   // do other stuff you want;

    // return true of false based on your logic

}

and

onsubmit="return newFunction(this)"


Saul



----- Original Message ----- 
From: "Clark Kent" <kryptoniteheman@yahoo.com>
To: "usergroup" <struts-user@jakarta.apache.org>
Sent: Monday, December 29, 2003 6:49 PM
Subject: How to perform validation and then call another javascript
function?


>
> I have a form in which upon submit, depending on whether a certain
checkbox is checked or not, it is directed to a certain action (if checked,
then action 1, if unchecked, then action 2). With the following code, I am
trying to validate the form.  Now I need to perform the validation and also
depending upon the checkbox condition (checked or not) I need to redirect it
to one of 2 actions. UpdateSubscription() is a javascript function which
directs to a certain action and then submits it.
>
> How can I do both the validation and also call this javascript function to
redirect to different actions. Can I use any condition within the onsubmit="
" ? Any help would be appreciated?
>
>
>
> <html:errors />
>
> <html:javascript formName="subscriptionForm" />
>
> <html:form name="subscriptionForm" onsubmit="return
validateSubscriptionForm(this);">
>
>
>
> <html:submit property="submitEnrollment" value="Submit"
>
> onclick="updateSubscription();"/>
>
>
>
> </html:form>
>
>
>
>
>
>
>
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Photos - Get your photo on the big screen in Times Square


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


Mime
View raw message