struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Taylor" <>
Subject Re: additional onsubmit javascript validation
Date Thu, 23 Sep 2010 11:28:00 GMT
Hi Mead,

Binding validation to the click event on the submit button is not what i 
This would fire my validation before the onsubmit validation occurs.

I want to leverage the Struts2 javascript validation framework which already 
Then, if that succeeds, I would like to fire additional javascript 
The Struts2 validation framework dynamically generates the appropriate 
validation for
the form if the form has validate="true". Otherwise it doesn't generate it. 
However, when
validate="true", it appends "return validateForm_MyAction();" as an onsubmit 
handler to any existing onsubmit attribute value.

With regards to your second suggestion "removing the onsubmit event". I 
cannot do this (without modifying code/template)
because if validate="true" in the form, it will automatically populate the 
form onsubmit attribute.

If I set validate="false", then the Struts2 validation framework doesn't 
auto-generate the form javascript validation.


----- Original Message ----- 
From: "Mead Lai" <>
To: "Struts Users Mailing List" <>
Sent: Wednesday, September 22, 2010 9:50 PM
Subject: Re: additional onsubmit javascript validation

> Hi Robert,
> Do you have another submit button? such as <s:submit/>,
> Try to bind a event listener to this button, that when you click this
> button, you do some validation();
> Another way is using the js to remove the  "onsubmit" event, then binding
> another method you write, and invoke the myValidation() in that method;
> bind
> AnoterMethod(){
> if(!validateForm_MyAction()){return;}
> //Here do your validation
> return myValidation()
> }
> Regards,
> Mead

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message