I wanted to validate a input text field. I am using validation.xml to do this. This is what i have written in my validation.xml
This works fine.But the problem is,i should not get the error message once the page is loaded .I should get it only when i hit the submit button. How should i modify my validation.xml to do this.I should basically put some check to see whether the submit button is hit or not. Any help will be really useful. Thanks.
Override the validate method and return null if the your submit button is not present in the request or is null(if present as a form parameter). If the submit button is pressed, return super.validate(arg0, arg1)
Joined: Jan 24, 2005
Thanks for the reply.But when we are using the validation framework do we need to override the validation()..???
Joined: Jul 26, 2005
I dont see the harm in overriding the validation method for the question you asked.
Alternatively, If you have two action classes - one when the page first loads(ViewAction class) and the other for submitting or CRUD operations(UpdateAction class) then you can set the validate="false" for the first class.