You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Trent Fisher <ol...@hotmail.com> on 2003/08/20 21:31:09 UTC

conditional submit to validator - multiple submission options, same page

I've recently been trying to get my application functioning with the Struts 
validator so that I can validate different subsets of fields on my page, 
based on a condition being true/false.  Just for background, I'm using the 
Struts Validator, along with the LookupDispatchAction and general 
Action/ValidatorForms (no DynaForms).  Let me explain the problem further:

I have a JSP with text fields A, B and C.  If Condition X is true, I'd like 
to submit the page and have the validator only execute validation on fields 
A and B.  If condition X is false, I'd like to execute the validation 
applied only to fields B and C.

It seems that I should be able to declare 2 distinct form beans within my 
struts-config file (both relying on the same ActionForm) along with 2 
matching <form> elements in the validation.xml and then dynamically choose 
which I'd like to execute when submitting my page.

My problem comes in figuring out how to dynamically set this.  I'd like to 
call a javascript function (call it fnChoose) onsubmit and then withing 
fnChoose, be able to set a hidden field or something to that effect that the 
struts-validator could key on to validate my forms.

Has anyone tried anything like this before, or is there another best 
practice approach for accomplishing this?

_________________________________________________________________
<b>Get MSN 8</b> and enjoy automatic e-mail virus protection.   
http://join.msn.com/?page=features/virus


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org