Rafael Taboada wrote:
Hi folks, I'm doing my validation for my form fields...
I use validation framework, so I don't use validate method in my form bean.
The problem I have is the validate is called when I use for first time the
module. I mean, when I see for frst ime the HTML form, validation is
called... Why???
When I set validate attribute to false in my action mapping, validation is
not called...
I want the validation is called only when the user click on submit button.
Did u have the same problem???
My Action extend DispatchAction class.
Thanks in advance.
Use 2 actions - one that shows the form and one that submit it, and
validate the form ONLY on the second action (set the "validate"
attribute in struts-config.xml to false or true respectively) This is a
very common pattern in Struts.
If you use a DispatchAction (or derived from) to show and submit the
form, than you have 2 choices:
1. the suggested upper (add just a smal forward action when you want to
show the form)
2. recognize which "method" of the action (view or submit) is called -
you can find it in the reuest, passed to validate() - and then make the
validation only in case of submit.
Regards
Borislav
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]