You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by David Geary <sa...@earthlink.net> on 2002/08/29 21:32:30 UTC

Validating a Range

I'm trying to validate a range using the validator. I've got this in 
validation.xml...

<form-validation>
    <formset>
        <form name='loginForm'>
            <field property='number' depends='range'>
                <arg0 key='login.number.displayName'/>
                <arg1 name='min' key='${var:min}' resource='false'/>
                <arg2 name='max' key='${var:max}' resource='false'/>
                <var>
                    <var-name>min</var-name>
                    <var-value>5</var-value>
                </var>
                <var>
                    <var-name>max</var-name>
                    <var-value>10</var-value>
                </var>
            </field>
        </form>
    </formset>
</form-validation>

...and this is how the field is defined in the form:

<html:form action='login.do' focus='name'>
    <table>
        <tr>
            <td><fmt:message key='login.number.displayName'/><td>
            <td><html:text property='number'/></td>
        </tr>
    </table>
</html:form>

The validation works: If I enter a value outside of the range, I get an 
error, and if not, I don't. But it's the error message that's the problem:

Number is not in the range null through null.

For some reason, even though the validator uses the correct min and max 
for validation, the error message doesn't reflect that. I've got the 
field display name and error message defined in my resource bundle, like 
this:

login.number.displayName=Number
errors.range={0} is not in the range {1} through {2}.

Does anyone know what's wrong?

Thanks,


david

Re: [VALIDATOR] Bad Error Message when Validating a Range

Posted by micael <ca...@harbornet.com>.
Should:
     login.number.displayName=Number
be:
     login.number.displayName=number
?????


At 08:40 AM 8/30/2002 -0600, you wrote:
>Sorry to repost this, but it got buried in a bunch of biere messages 
>yesterday...
>
>I'm trying to validate a range using the validator. I've got this in 
>validation.xml...
>
><form-validation>
>   <formset>
>       <form name='loginForm'>
>           <field property='number' depends='range'>
>               <arg0 key='login.number.displayName'/>
>               <arg1 name='min' key='${var:min}' resource='false'/>
>               <arg2 name='max' key='${var:max}' resource='false'/>
>               <var>
>                   <var-name>min</var-name>
>                   <var-value>5</var-value>
>               </var>
>               <var>
>                   <var-name>max</var-name>
>                   <var-value>10</var-value>
>               </var>
>           </field>
>       </form>
>   </formset>
></form-validation>
>
>...and this is how the field is defined in the form:
>
>The validation works: If I enter a value outside of the range, I get an 
>error, and if not, I don't. But it's the error message that's the problem: 
>Number is not in the range null through null. For some reason, even though 
>the validator uses the correct min and max for validation, the error 
>message doesn't reflect that. I've got the field display name and error 
>message defined in my resource bundle, like this: 
>login.number.displayName=Number errors.range={0} is not in the range {1} 
>through {2}. Does anyone know what's wrong? Thanks, david



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [VALIDATOR] Bad Error Message when Validating a Range

Posted by David Geary <sa...@earthlink.net>.
Ted Husted wrote:

> It looks right to me, David (and welcome back, BTW).

Me too, and thanks.

> Maybe we need to add a test case to the validator sample app to be 
> sure everything is still working as advertised.

That's probably a good idea. I think it needs some rigorous testing; 
I've run into other problems also.

> Are you using beta 2 or what? 

I'm using the nightly build from 8/19.


david

>
>
> -Ted.
>
> David Geary wrote:
>
>> Sorry to repost this, but it got buried in a bunch of biere messages 
>> yesterday...
>>
>> I'm trying to validate a range using the validator. I've got this in 
>> validation.xml...
>>
>> <form-validation>
>>   <formset>
>>       <form name='loginForm'>
>>           <field property='number' depends='range'>
>>               <arg0 key='login.number.displayName'/>
>>               <arg1 name='min' key='${var:min}' resource='false'/>
>>               <arg2 name='max' key='${var:max}' resource='false'/>
>>               <var>
>>                   <var-name>min</var-name>
>>                   <var-value>5</var-value>
>>               </var>
>>               <var>
>>                   <var-name>max</var-name>
>>                   <var-value>10</var-value>
>>               </var>
>>           </field>
>>       </form>
>>   </formset>
>> </form-validation>
>>
>> ...and this is how the field is defined in the form:
>>
>> <html:form action='login.do' focus='name'>
>>   <table>
>>       <tr>
>>           <td><fmt:message key='login.number.displayName'/><td>
>>           <td><html:text property='number'/></td>
>>       </tr>
>>   </table>
>> </html:form>
>>
>> The validation works: If I enter a value outside of the range, I get 
>> an error, and if not, I don't. But it's the error message that's the 
>> problem:
>>
>> Number is not in the range null through null.
>>
>> For some reason, even though the validator uses the correct min and 
>> max for validation, the error message doesn't reflect that. I've got 
>> the field display name and error message defined in my resource 
>> bundle, like this:
>>
>> login.number.displayName=Number
>> errors.range={0} is not in the range {1} through {2}.
>>
>> Does anyone know what's wrong?
>>
>> Thanks,
>>
>>
>> david
>>
>>
>
>
>
> -- 
> To unsubscribe, e-mail:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>
>
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [VALIDATOR] Bad Error Message when Validating a Range

Posted by Ted Husted <hu...@apache.org>.
It looks right to me, David (and welcome back, BTW).

Maybe we need to add a test case to the validator sample app to be sure 
everything is still working as advertised.

Are you using beta 2 or what?

-Ted.

David Geary wrote:

> Sorry to repost this, but it got buried in a bunch of biere messages 
> yesterday...
>
> I'm trying to validate a range using the validator. I've got this in 
> validation.xml...
>
> <form-validation>
>   <formset>
>       <form name='loginForm'>
>           <field property='number' depends='range'>
>               <arg0 key='login.number.displayName'/>
>               <arg1 name='min' key='${var:min}' resource='false'/>
>               <arg2 name='max' key='${var:max}' resource='false'/>
>               <var>
>                   <var-name>min</var-name>
>                   <var-value>5</var-value>
>               </var>
>               <var>
>                   <var-name>max</var-name>
>                   <var-value>10</var-value>
>               </var>
>           </field>
>       </form>
>   </formset>
> </form-validation>
>
> ...and this is how the field is defined in the form:
>
> <html:form action='login.do' focus='name'>
>   <table>
>       <tr>
>           <td><fmt:message key='login.number.displayName'/><td>
>           <td><html:text property='number'/></td>
>       </tr>
>   </table>
> </html:form>
>
> The validation works: If I enter a value outside of the range, I get 
> an error, and if not, I don't. But it's the error message that's the 
> problem:
>
> Number is not in the range null through null.
>
> For some reason, even though the validator uses the correct min and 
> max for validation, the error message doesn't reflect that. I've got 
> the field display name and error message defined in my resource 
> bundle, like this:
>
> login.number.displayName=Number
> errors.range={0} is not in the range {1} through {2}.
>
> Does anyone know what's wrong?
>
> Thanks,
>
>
> david
>
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [VALIDATOR] Bad Error Message when Validating a Range

Posted by David Geary <sa...@earthlink.net>.
Thanks for the suggestion, but that didn't work either.

It's strange because I'm validating other fields in the same form and 
the error messages are correct for those fields. Also, If I change the 
range message in the resource bundle, that change is reflected in the 
message, but it always displays null for both the min and max values, 
even though the validator correctly uses those values to perform the 
validation.


david

micael wrote:

> David, should you be adding the <msg/>???? as I have below  AND, 
> shouldn't login.number.displayName=Number be 
> login.number.displayName=number?
>
> At 08:40 AM 8/30/2002 -0600, you wrote:
>
>> Sorry to repost this, but it got buried in a bunch of biere messages 
>> yesterday...
>>
>> I'm trying to validate a range using the validator. I've got this in 
>> validation.xml...
>>
>> <form-validation>
>>   <formset>
>>       <form name='loginForm'>
>>           <field property='number' depends='range'>
>
>
>                       <msg name="number" key=" 
> login.number.displayName"/>  <<<<<<<<<<<<<<
>
>>               <arg0 key='login.number.displayName'/>
>>               <arg1 name='min' key='${var:min}' resource='false'/>
>>               <arg2 name='max' key='${var:max}' resource='false'/>
>>               <var>
>>                   <var-name>min</var-name>
>>                   <var-value>5</var-value>
>>               </var>
>>               <var>
>>                   <var-name>max</var-name>
>>                   <var-value>10</var-value>
>>               </var>
>>           </field>
>>       </form>
>>   </formset>
>> </form-validation>
>>
>> ...and this is how the field is defined in the form:
>>
>> The validation works: If I enter a value outside of the range, I get 
>> an error, and if not, I don't. But it's the error message that's the 
>> problem: Number is not in the range null through null. For some 
>> reason, even though the validator uses the correct min and max for 
>> validation, the error message doesn't reflect that. I've got the 
>> field display name and error message defined in my resource bundle, 
>> like this: login.number.displayName=Number errors.range={0} is not in 
>> the range {1} through {2}. Does anyone know what's wrong? Thanks, david
>
>
>
>
> -- 
> To unsubscribe, e-mail:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>
>
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [VALIDATOR] Bad Error Message when Validating a Range

Posted by micael <ca...@harbornet.com>.
David, should you be adding the <msg/>???? as I have below  AND, shouldn't 
login.number.displayName=Number be login.number.displayName=number?

At 08:40 AM 8/30/2002 -0600, you wrote:
>Sorry to repost this, but it got buried in a bunch of biere messages 
>yesterday...
>
>I'm trying to validate a range using the validator. I've got this in 
>validation.xml...
>
><form-validation>
>   <formset>
>       <form name='loginForm'>
>           <field property='number' depends='range'>

                       <msg name="number" key=" 
login.number.displayName"/>  <<<<<<<<<<<<<<

>               <arg0 key='login.number.displayName'/>
>               <arg1 name='min' key='${var:min}' resource='false'/>
>               <arg2 name='max' key='${var:max}' resource='false'/>
>               <var>
>                   <var-name>min</var-name>
>                   <var-value>5</var-value>
>               </var>
>               <var>
>                   <var-name>max</var-name>
>                   <var-value>10</var-value>
>               </var>
>           </field>
>       </form>
>   </formset>
></form-validation>
>
>...and this is how the field is defined in the form:
>
>The validation works: If I enter a value outside of the range, I get an 
>error, and if not, I don't. But it's the error message that's the problem: 
>Number is not in the range null through null. For some reason, even though 
>the validator uses the correct min and max for validation, the error 
>message doesn't reflect that. I've got the field display name and error 
>message defined in my resource bundle, like this: 
>login.number.displayName=Number errors.range={0} is not in the range {1} 
>through {2}. Does anyone know what's wrong? Thanks, david



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


[VALIDATOR] Bad Error Message when Validating a Range

Posted by David Geary <sa...@earthlink.net>.
Sorry to repost this, but it got buried in a bunch of biere messages 
yesterday...

I'm trying to validate a range using the validator. I've got this in 
validation.xml...

<form-validation>
   <formset>
       <form name='loginForm'>
           <field property='number' depends='range'>
               <arg0 key='login.number.displayName'/>
               <arg1 name='min' key='${var:min}' resource='false'/>
               <arg2 name='max' key='${var:max}' resource='false'/>
               <var>
                   <var-name>min</var-name>
                   <var-value>5</var-value>
               </var>
               <var>
                   <var-name>max</var-name>
                   <var-value>10</var-value>
               </var>
           </field>
       </form>
   </formset>
</form-validation>

...and this is how the field is defined in the form:

<html:form action='login.do' focus='name'>
   <table>
       <tr>
           <td><fmt:message key='login.number.displayName'/><td>
           <td><html:text property='number'/></td>
       </tr>
   </table>
</html:form>

The validation works: If I enter a value outside of the range, I get an 
error, and if not, I don't. But it's the error message that's the problem:

Number is not in the range null through null.

For some reason, even though the validator uses the correct min and max 
for validation, the error message doesn't reflect that. I've got the 
field display name and error message defined in my resource bundle, like 
this:

login.number.displayName=Number
errors.range={0} is not in the range {1} through {2}.

Does anyone know what's wrong?

Thanks,


david