File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes performing client side validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "performing client side validation" Watch "performing client side validation" New topic
Author

performing client side validation

Manisha reddy
Greenhorn

Joined: May 02, 2006
Posts: 16
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
ram gaurav
Ranch Hand

Joined: Mar 29, 2006
Posts: 208
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 ...???
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
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 ]

Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: performing client side validation