You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Greg Dunn <gr...@mo.nisc.cc> on 2003/05/22 17:24:41 UTC

Validator requiredif error message

Apparently requiredif uses the same message resource key as required
(errors.required)  I would like to see a more relevant error message when
using requiredif so I can output something like "fieldX is required if
'whatever'".

I did the following but it doesn't work, all I get is "fieldX is required".

In validation.xml:

<field
    property="x_First_Name"
    depends="requiredif">
    <arg0 key="paymentCC.form.firstName.prompt"/>
    <arg1 key="paymentCC.form.firstName.requiredif"/>

In Resources:

errors.requiredif={0} is required if {1}

paymentCC.form.firstName.prompt=First Name
paymentCC.form.firstName.requiredif=you indicated above that you smell funny



Greg


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


RE: Validator requiredif error message

Posted by "Bradley M. Handy" <br...@williamstonfmc.org>.
Make the following changes:

Add <msg name="requiredif" key="key.to.error.message" />

Add 'name="requiredif"' to your arg0 and arg1 elements.


That should do the trick.

Brad Handy


-------------------------------------------------
Bradley M. Handy		| Office: 517 750 6675
Programmer/Analyst	| Email: bhandy@arbor.edu
Spring Arbor University	|
-------------------------------------------------
Sun Certified Programmer for the Java 2 Platform
-------------------------------------------------

-----Original Message-----
From: Greg Dunn [mailto:greg.dunn@mo.nisc.cc] 
Sent: Thursday, May 22, 2003 11:25 AM
To: Struts Users Mailing List
Subject: Validator requiredif error message

Apparently requiredif uses the same message resource key as required
(errors.required)  I would like to see a more relevant error message
when
using requiredif so I can output something like "fieldX is required if
'whatever'".

I did the following but it doesn't work, all I get is "fieldX is
required".

In validation.xml:

<field
    property="x_First_Name"
    depends="requiredif">
    <arg0 key="paymentCC.form.firstName.prompt"/>
    <arg1 key="paymentCC.form.firstName.requiredif"/>

In Resources:

errors.requiredif={0} is required if {1}

paymentCC.form.firstName.prompt=First Name
paymentCC.form.firstName.requiredif=you indicated above that you smell
funny



Greg


---------------------------------------------------------------------
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