struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Taylor" <rtay...@dtgresults.com>
Subject additional onsubmit javascript validation
Date Thu, 23 Sep 2010 01:26:38 GMT
Greetings,

I'm using Struts2.2.1 and have a form using the xhtml theme which performs some simple javascript
validation (required, etc...).
Works great.
Now, after the simple javascript validation executes I would like to add some more validation
to the onsubmit event.
Apart from modifying a template, I couldn't see how this could be achieved easily.
If you include the validation in the form onsubmit attribute, it is prepended to the dynamically
generated javascript validation function name. 

For example:
<s:form action="MyAction" namespace="/mynamespace" theme="xhtml" validate="true" onsubmit="return
myValidation()">

produces the following markup.

<form id="Myaction" 
         name="MyAction" 
         onsubmit="return myValidation(); return validateForm_MyAction();" 
         action="/scname/mynamespace/MyAction.html" method="post"  
         onreset="clearErrorMessages(this);clearErrorLabels(this);">

As is evident, this won't work for me. 

I want to leverage the dynamically generated Javascript validation when validate="true". If
that validation succeeds, then I want to execute some proprietary validation.

I also know the name of the dynamically generated javascript method so I could call it in
myValidation();


Any suggestions would be appreciated.

Thanks,

/robert



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message