Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unexpected behavior of Validator's Java Script

 
Velika Srbija
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
During development of a Struts based wizard-app I encountered very strange behavior of Validator's JavaScript.
Lost almost whole night trying to figure out what is goin' on.?

Here is description of the problem:

JSP page:
------------
...
<html:javascript formName="appForm" />
...
<html:form action="appAction.do" onsubmit="return validateAppForm(this)" >
<html:hidden property="page" value="1" />
<html:text property="proba" value="" />
...

validation.xml
--------------
...
<formset>
...
<form name="appForm">
<field property="proba" page="1" depends="required,integer">
<arg0 key="resources.error.proba" />
</field>
</form>
...
</formset>

Server-side validation runs OK, but client-side validation doesn't occur at all?
I have figured out why is that happening, but currently have no solution. Here lies the problem:
In order to force client-side validation "page" attribute should be removed from the <field> tag in validation.xml file.
In that case everything runs OK but there is no wizard style of my app.

Is it a bug in the Validator framework, or I'm doing somethig wrong?
Have You any solution?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic