You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Dhruva B. Reddy" <sl...@yahoo.com> on 2003/10/02 00:29:54 UTC

Validation Problems

I am trying to validate a form that includes, among other things, a
checkbox and a text field that contains a credit card number.

I specify that the checkbox is "required".  I assume this means this
means the checkbox must be checked in order for validation to succeed? 
However, validation for the form succeeds without this.  Here is the
code from validation.xml:

              <field property="termsAccepted"
                     depends="required">
                  <msg
                    name="required"
                    key="errors.required"/>

                  <arg0 key="bookingActionForm.termsAccepted"/>
              </field>

Also, the credit card validation succeeds no matter what I put in for
that field.  Here is the code I have for that:

              <field property="ccNumber"
                     depends="required,creditCard">
                  <msg
                    name="required"
                    key="errors.required"/>
                  <msg
                    name="creditCard"
                    key="errors.creditcard"/>

                  <arg0 key="bookingActionForm.ccNumber"/>
              </field>

(it does complain when I leave this field blank).

Can anyone tell me what I might be doing wrong?

Thanks,
-d

__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

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


Re: Validation Problems

Posted by Robert Leland <rl...@apache.org>.
Dhruva B. Reddy wrote:

>I am trying to validate a form that includes, among other things, a
>checkbox and a text field that contains a credit card number.
>  
>

The nightly build of struts now handles checkboxes, select's, radio buttons.

>I specify that the checkbox is "required".  I assume this means this
>means the checkbox must be checked in order for validation to succeed? 
>However, validation for the form succeeds without this.  Here is the
>code from validation.xml:
>
>              <field property="termsAccepted"
>                     depends="required">
>                  <msg
>                    name="required"
>                    key="errors.required"/>
>
>                  <arg0 key="bookingActionForm.termsAccepted"/>
>              </field>
>
>Also, the credit card validation succeeds no matter what I put in for
>that field.  Here is the code I have for that:
>
>              <field property="ccNumber"
>                     depends="required,creditCard">
>                  <msg
>                    name="required"
>                    key="errors.required"/>
>                  <msg
>                    name="creditCard"
>                    key="errors.creditcard"/>
>
>                  <arg0 key="bookingActionForm.ccNumber"/>
>              </field>
>
>(it does complain when I leave this field blank).
>
>Can anyone tell me what I might be doing wrong?
>
>Thanks,
>-d
>
>__________________________________
>Do you Yahoo!?
>The New Yahoo! Shopping - with improved product search
>http://shopping.yahoo.com
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
>  
>



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