• 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

performing client side validation

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how can struts framework performs client side validations since to validate the request has to be passed on to the server side which reads validations.xml file and validation-rules.xml file.

thanks in advance
 
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use <html:javascript /> tag in your <HEAD> section of your page , which will show the errors as like javascript shows with the help of alerts,
do you want this or what ...???
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The way it works is this: You put the <html:javascript formName="myForm" > tag in a JSP. When Struts renders that tag, it looks in the validations.xml file and finds the validation information pertaining to "myForm". It then generates javascript based on the validation rules you have specified and puts that javascript code in the HTML that is sent to the browser. Then, when users access the page on their browsers, the javascript code runs on the browser and performs validations when the submit button is pressed.

One other step that is necessary for client side validation is that you must add onsubmit="return validateMyForm(this)" in your <html:form> tag. The validateMyForm() method is generated by the <html:javascript> tag.
[ May 04, 2006: Message edited by: Merrill Higginson ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic