Hi, How do I use struts validator and my own javascript functions at the same time ? Right now because I am using the validator for client-side validations, i write the onsubmit as "return validateFormName(this)". For the checks not included by the struts validator, how do i call my own javascript methods ? please help.
Amirtharaj Chinnaraj
Ranch Hand
Joined: Sep 28, 2006
Posts: 215
posted
0
hi meera
you have to write the java scripts methods in the jsp
and call them on some events like onclick
regards amir [ April 05, 2007: Message edited by: Amirtharaj Chinnaraj ]
Meera Godse
Greenhorn
Joined: Jan 09, 2007
Posts: 28
posted
0
thank you for your response. Isnt there any other way to do it ? I want my methods to be called after all the validator methods have been called. Right at the end. For an onclick event, these methods will be called first & then the validator ones will be executed. Is there no way, i can write both validator methods & my methods without these problems ? Validator is unable to provide my requirement , so I must write my own methods along with the validator ones. pls help
Amirtharaj Chinnaraj
Ranch Hand
Joined: Sep 28, 2006
Posts: 215
posted
0
well first i would like to ask you wether you
examined this sceniaro. see when you are using both
javaScript and validator framework for clentside validation
java script will be invoked first and then the validator framework
Make sure you also implement the back end validation rules as well and everything should work the way you want it to.
Meera Godse
Greenhorn
Joined: Jan 09, 2007
Posts: 28
posted
0
I am not quite clear with the example provided. Is 'ValidationUtil' a simple class with this one method of validate fields ? Do I write my javascript methods in this class just the way I would write them down on my JSP ? Can i write multiple javascript methods here ? and how do i access the controls of JSP through this method (eg: I want to validate the array of objects. so how can i access each textbox control ?)
Just a wild thought .... can we use the validate method of the form-bean in any way, for using my own javascript methods ?
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.