• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Validator Framework

 
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 168
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
TryHope it's as simple as this

- Peter
 
Jack Lau
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks!!

Jack
 
Being a smart alec beats the alternative. This tiny ad knows what I'm talking about:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic