aspose file tools*
The moose likes Struts and the fly likes Unexpected behavior of Validator's Java Script Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Unexpected behavior of Validator Watch "Unexpected behavior of Validator New topic
Author

Unexpected behavior of Validator's Java Script

Velika Srbija
Ranch Hand

Joined: Jan 15, 2002
Posts: 172
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?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Unexpected behavior of Validator's Java Script