• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Have any problem using validator

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One problem with Struts validation is that it doesn't do client-side (JavaScript) validation for indexed properties.
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you all for your messages. Have any performance issue using validator?
 
The overall mission is to change the world. When you've done that, then you can read this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic