This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of DevSecOps Adventures: A Game-Changing Approach with Chocolate, LEGO, and Coaching Games and have Dana Pylayeva on-line!
See this thread for details.
  • 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

purpose of javascript code in validator-rules.xml ?

 
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

In some validator-rules.xml files I have seen code like this:


whats the purpose of having javascript code along with validation rule?
what is cdata ?

Thanks.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi when you want to do Client side validation with out going to server this java script will useful.
 
Ja vardhan
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How this Javascript will be used to do client side validations? Pls explain me in briref what and all we need to do for client side validations with this Javascript?

Nayak- you said without going server side we can do client side validation.
Validator-rules.xml file is available at server side only, then how the validation will happen at client side? Pls explain me the concept clearly.

Thanks.
 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I suggest that you jump over to Google and type in "struts client side validation". You are likely to find much more complete answer....plus you don't have to wait for a reply. If you have specific questions then feel free to post them here.

- Brent
 
Ja vardhan
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Brent,

I have already done google serach on this, but all those links telling about enabling client side java script using <html:javascript> in jsp.

I dint find any information regarding this javascript existing in validator-rules.xml file. I want to know how can we utilise that javascript code at client side.

Please help.

Thanks.
 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Javardhan:

It is hard to follow your questions when you have so many different threads asking related questions. Have you figured out that in order to enable client-side validation for a custom validator you have to basically duplicate your validation in JavaScript? The Java code that you wrote only gets executed on the server side.

- Brent
 
Ja vardhan
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Brent,

Now I understood the concept.

I have written javascript in validator-rules.xml, enabled client side javascript using <html:javascript> .
After running the application, I saw the code using 'view source'....all that java script code which I have written in validator-rules.xml is at client side now.

Thanks for your all replies.
 
The problems of the world fade way as you eat a piece of pie. This tiny ad has never known problems:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic