You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Matt Raible <ma...@yahoo.com> on 2001/07/23 21:32:47 UTC

Validation Framework: Mask Msg for Range Validation

I have a range I want to validate, and I want to display a maskmsg when the
value is not in that range.  The reason is because I want to add HTML
formatting around the error message.  Is there a place in validation.xml or in
my ApplicationResources.properties that I can do this?

I tried that following, but it throws a NullPointerException:

		 <field property="holidayDO.displayMonth" 
              depends="required,integer,range,mask">
		  		<msg name="mask" key="holidayManage.displayMonth.maskmsg" />
          <arg0 key="holidayManage.prompt.displayMonth"/>
          <arg1 name="range" key="${var:min}" resource="false"/>
          <arg2 name="range" key="${var:max}" resource="false"/>
          <var>
             <var-name>min</var-name>
             <var-value>1</var-value>
          </var>
          <var>
             <var-name>max</var-name>
             <var-value>12</var-value>
          </var>
     	 </field>

If I removed depends="...mask" and <msg name>, it works fine, but the error is
not formatted?

Thanks,

Matt

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

Re: Validation Framework: Mask Msg for Range Validation

Posted by Matt Raible <ma...@yahoo.com>.
Nevermind, I found it as errors.range in ApplicationResources.properties.

Matt

--- Matt Raible <ma...@yahoo.com> wrote:
> I have a range I want to validate, and I want to display a maskmsg when the
> value is not in that range.  The reason is because I want to add HTML
> formatting around the error message.  Is there a place in validation.xml or
> in
> my ApplicationResources.properties that I can do this?
> 
> I tried that following, but it throws a NullPointerException:
> 
> 		 <field property="holidayDO.displayMonth" 
>               depends="required,integer,range,mask">
> 		  		<msg name="mask" key="holidayManage.displayMonth.maskmsg" />
>           <arg0 key="holidayManage.prompt.displayMonth"/>
>           <arg1 name="range" key="${var:min}" resource="false"/>
>           <arg2 name="range" key="${var:max}" resource="false"/>
>           <var>
>              <var-name>min</var-name>
>              <var-value>1</var-value>
>           </var>
>           <var>
>              <var-name>max</var-name>
>              <var-value>12</var-value>
>           </var>
>      	 </field>
> 
> If I removed depends="...mask" and <msg name>, it works fine, but the error
> is
> not formatted?
> 
> Thanks,
> 
> Matt
> 
> __________________________________________________
> Do You Yahoo!?
> Make international calls for as low as $.04/minute with Yahoo! Messenger
> http://phonecard.yahoo.com/


__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/