struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Trent Fisher" <olaf0...@hotmail.com>
Subject conditional submit to validator - multiple submission options, same page
Date Wed, 20 Aug 2003 19:31:09 GMT
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


Mime
View raw message