the first you must add the page attribute in your form bean
    <form-bean name="processAdditionalForm"
type="org.apache.struts.validator.DynaValidatorForm">
      <form-property initial="0" name="calculationType"
type="java.lang.String" />
      <form-property name="isTradeUnion" type="java.lang.String" />
      <form-property name="isDecret" type="java.lang.String" />
      <form-property initial="0" name="page" type="java.lang.Integer" />
    </form-bean>

and change validation.xml like
      <form name="processAdditionalForm">
         <field
                property="calculationType"
                depends="required,integer" page="1">
                <arg0 key="validator.calculationType"/>
         </field>
         <field
                property="isDecret"
                depends="required,integer" page="2">
                <arg0 key="validator.isDecret"/>
         </field>
      </form>

in this case when page=1 then only calculationType validate, when page=2
then calculationType and isDecret validate.
when page=n (fields from page attr page=0..n validate)

-----Original Message-----
From: Patrick Cheng [mailto:[EMAIL PROTECTED]
Sent: Friday, January 16, 2004 12:49 PM
To: Struts Users Mailing List
Subject: RE: Disable validator framework


If you want to do validation conditionally, you can disable validation
in struts-config, and call 'form.validate' explicitly in the Action
class.(base on your condition)
About the 'page' attribute, what I don't understand is, how does struts
know which fields are in page 1, which fields are in page 2,3,4..., in
order to do the validation for the current+previous pages only?

Rgds,
Patrick.

-----Original Message-----
From: Andriy Ruzhevych [mailto:[EMAIL PROTECTED]
Sent: Friday, January 16, 2004 4:50 PM
To: Struts Users Mailing List; [EMAIL PROTECTED]
Subject: RE: Disable validator framework


You can try to use the page attribute of the field element. "Only fields
with a page attribute value that is equal to or less than the value of
the page property on the form JavaBean are processed. This is useful
when using a "wizard" approach to completing a large form, to ensure
that a page is not skipped"

-----Original Message-----
From: Mohan Radhakrishnan [mailto:[EMAIL PROTECTED]
Sent: Friday, January 16, 2004 8:34 AM
To: 'Struts Users Mailing List'
Subject: Disable validator framework


Hi

    We are using dispatch action and validator framework. There is a
popup action associated with one button on the form. When the user
clicks on this a particular method in the action is called but I don't
want to validate the ActionForm because the main form is not submitted.
There are other buttons that submit the form and I need a selective
validator framework.

   I know that it is possible if I were to write my own validate()
method by checking a particular value in the form.

   Can I disable the validator similarly ? If this is not possible then
I have to abandon the validator.

    Appreciate ideas.
Mohan


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


__________ NOD32 1.596 (20040109) Information __________

This message was checked by NOD32 antivirus system. http://www.nod32.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]


__________ NOD32 1.596 (20040109) Information __________

This message was checked by NOD32 antivirus system.
http://www.nod32.com



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

Reply via email to