| Author |
Struts Validation
|
Mary Cole
Ranch Hand
Joined: Dec 02, 2000
Posts: 362
|
|
|
Is it possible to specify the <form name=ACTIONAME"> in Validation.xml instead of actual form name
|
 |
alan do
Ranch Hand
Joined: Apr 14, 2005
Posts: 354
|
|
short answer, no i am assuming you are looking to validate depending on which action you call, particularly you don't want validation to occur when the user is presented the first time? there are a couple of ways to go about it. 1. use requiredif rule or validwhen (struts 1.2), you'll need to have a hidden field being set on submit (via javascript). if that field is blank, then don't validate. ugly? yes! 2. structure your action-mappings intelligently. create 2 action mappings with 2 different paths, but pointing to the same form-bean. in the second action, change the validate attribute to "true" and set the input to the path of the first action-mapping. ex. <action path="form/entry" name="MyForm">....</action> <action path="form/process" name="MyForm" type="ProcessAction" validate="true" input="form/entry.do">....</action> intially, the user goes to /form/entry.do which (the jsp/tile) contains a form mapped to the action "form/process".
|
-/a<br />certified slacker...yes, my last name is 'do' - <a href="http://www.luckycouple.com" target="_blank" rel="nofollow">luckycouple.com</a>
|
 |
 |
|
|
subject: Struts Validation
|
|
|