• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Have any problem using validator

 
Sunil George
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am currently working on a Struts application. For form variable validation we use javascript instead of validator. Is there any problem using validator?
 
poornima balagopal
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
there is no problem in using validator. Most of the general validations we need to performs for the fields in the form, have been covered by validation.You just need to associate your fields with the required validations in your application level validation.xml file.


regards
Poornima
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One problem with Struts validation is that it doesn't do client-side (JavaScript) validation for indexed properties.
 
yin jiang
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Struts validation do client-side (JavaScript) validation for indexed properties too.

you can write your validation.xml file as this :

<field property="approver[0]" depends="short">
<msg name="short" key="errors.user.id.not.int"/>
</field>
<field property="approver[1]" depends="short">
<msg name="short" key="errors.user.id.not.int"/>
</field>

One problem I am facing now is the client-side validation will import all validate scripts even if you don't need them. It will make your HTML page very big.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This method is still unacceptably awkward for me, since I have no idea how many rows there will be in a dynamic table at run time. If I have 500 rows, am I going to repeat this code 500 times?

As I see it, the only acceptable solution for client-side validation of indexed properties is to write my own javascript code.
 
Sunil George
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you all for your messages. Have any performance issue using validator?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic