File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Validator Framework Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Validator Framework" Watch "Validator Framework" New topic
Author

Validator Framework

Jack Lau
Ranch Hand

Joined: Aug 30, 2002
Posts: 166
Hello All,

I configurate the validator with struts it works but both client-side javascript error message and server-side error message are show. Does any one tell me how to configurate the validation.xml in order to allow only client-side validation ?

Thanks,
Jack
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
You don't want that. The client-side validation is not complete, and tightly locked down clients may not run your JavaScript at all. You always must have server-side validation whatever you do. Your problem is probably an incorrect implementation of the client-side validation scripts. Please show us what you've got there.

- Peter
Jack Lau
Ranch Hand

Joined: Aug 30, 2002
Posts: 166
My code are listed below:

In register.jsp
[CODE]
<html>
<html:form action="/Register" onsubmit="validateRegisterForm(this)">
<table>
<tr>
<td>User ID:</td>
<td><html:text property="userId" size="20"/></td>
</tr>
</table>
</html:form>
<html:javascript formName="registerForm"/>
</html>
[CODE]
In validation.xml
[CODE]
<field
property="userId"
depends="required, mask, minlength, maxlength">
<msg name="mask" key="register.userId.mask"/>
<msg name="minlength" key="register.userId.minlength"/>
<msg name="maxlength" key="register.userId.maxlength"/>
<arg0 key="register.userId.displayname"/>
<arg1 nam="minlength" key="${var:minlength}" resource="false"/>
<arg2 nam="maxlength" key="${var:maxlength}" resource="false"/>
<var>
<var-name>mask</var-name>
<var-value>^[a-zA-Z0-9]*$</var-value>
</var>
<var>
<var-name>minlength</var-name>
<var-value>6</var-value>
</var>
<var>
<var-name>maxlength</var-name>
<var-value>12</var-value>
</var>
</field>
[CODE]

Any problem ?
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
TryHope it's as simple as this

- Peter
Jack Lau
Ranch Hand

Joined: Aug 30, 2002
Posts: 166
Thanks!!

Jack
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Validator Framework