You can use the "page" attribute on the validations, with the "page"
attribute. Look at
http://struts.apache.org/struts-doc-1.2.9/userGuide/dev_validator.html
under "Multi page forms" for an extremely brief overview.

Basically,  create a java.lang.Integer variable in your form called
"page" and before you call form.validate() set this page variable
appropriately: if subtotal was pressed set page=1, if submit then
page=2.

Define validations common to both in validations with page=1, and
submit only with page=2 in validation.xml:
<form name="SomeForm">
 <field property="quantity" page="1" depends="required"> ... </field>
 <field property="address" page="2" depends="required">...</field>
 ...
</form>

It's not the most elegant, but it does work well when you have a
linear page flow.

-ed

On 6/26/06, Jennifer Jacobs <[EMAIL PROTECTED]> wrote:

I'm using the Struts Validator framework.

I have a form with two buttons on it, one that calculates a subtotal and one
that submits the form.  I have validation set to false, because I don't want
to validate the shipping address/email/phone number/etc when they calculate
the subtotal.  So, I do a form.validate() when the submit button is hit.

However, I DO want to validate the values they put in for quantity, etc.  I
know I can write validation for it all, but then my validation is in two
places - is there any way to "tell" it to validate JUST a certain set of
fields?

Thanks in advance,
Jennifer
--
View this message in context: 
http://www.nabble.com/Validate-just-certain-fields-t1850707.html#a5052596
Sent from the Struts - User forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to