Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

performing client side validation

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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 ]
 
Today's lesson is that you can't wear a jetpack AND a cape. I should have read this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic