Chetan Pandey wrote:
Is their a way to specify multiple inputs.
Nope. A wise man once told me that validate="true" is there only for
convenience. So the workaround is to do something like
'validate="false"', omit the input= tag, and add forwards like,
<action...>
<forward name="add" path="page.add" />
<forward name="edit" path="page.edit" />
</action>
public void create( ActionMapping mapping, ... ) {
ActionErrors errors = form.validate( mapping, request );
if ( errors == null ) {
errors = new ActionErrors();
} else if ( !errors.isEmpty() ) {
saveErrors( errors );
return mapping.findForward( "add" );
}
// Do some stuff
// ... aaaaand success!
myForm.setId( someObject.getId() );
return mapping.findForward( "edit" );
}
So if it passes validation and everything checks out okay, it goes to
the edit page to the newly added record. Otherwise it goes back to
add. You can do the same thing for delete (ie: if you were editing a
record, but suddenly lose the state of the record you're editing because
the user is mucking about).
This gives you more power over when and how to do validation, and what
to do on pass/fail (sometimes you might have to repopulate a few of the
ActionForm's values--which is something else you can't do with the
validate="true" shortcut).
- Scott
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]