I am using Integer instead of int now but whenever
the input field is left blank I am still getting this
Invalid field value for field "year" message.

So my results so far are like this:

these behave as expected:
    validationtest.action
    validationtest.action?year=12312313

this gives "Invalid field value for field "year" message:
    validationtest.action?year=

I feel that it should not give that error. Removing
"year=" from url is not an option because this kind
of url is what we get if there is an input form field
that is left blank.

So, what to you think what should be the ww2 way
of validating this kind of field?

best wishes,
Taavi


----- Original Message ----- 
From: "Jason Carreira" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, November 23, 2003 4:15 PM
Subject: RE: [OS-webwork] validator for the optional int field


> Did you try the IntRangeFieldValidator? It doesn't require a value...
> Actually, if you have a primitive int, it will always get a value and
> validate it... If it's an Integer you can have a null value, in which
> case it would ignore it. 
> 
> > -----Original Message-----
> > From: Taavi Tiirik [mailto:[EMAIL PROTECTED] 
> > Sent: Sunday, November 23, 2003 8:48 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [OS-webwork] validator for the optional int field
> > 
> > 
> > Sorry for not being clear ")
> > 
> > I would like to specify field error message, if the field is 
> > filled with a value but this value is outside of some min-max range.
> > 
> > And I would like to see this field pass this valiation rule 
> > if the field is left empty.
> > 
> > So something like this comes to my mind:
> > 
> >  <field name="year">
> >   <field-validator type="optional-int">
> >    <param name="min">6</param>
> >    <param name="max">10</param>
> >    <message>bar must be between ${min} and ${max}, current 
> > value is ${bar}.</message>
> >   </field-validator>
> >  </field>
> > 
> > 
> > > What do you want to validate about that field?
> > >
> > > > -----Original Message-----
> > > > From: Taavi Tiirik [mailto:[EMAIL PROTECTED]
> > > > Sent: Sunday, November 23, 2003 8:04 AM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: [OS-webwork] validator for the optional int field
> > > >
> > > >
> > > > How should I write a validator for the optional int field in ww2?
> > > >
> > > > I have getter and setter in my action:
> > > > public int getYear(){ return year; }
> > > > public void setYear( int year ){ this.year = year; }
> > > >
> > > > input field is defined like this:
> > > > #tag( TextField "label='year'" "name='year'" "value=year" 
> > "size='5'" 
> > > > )
> > > >
> > > > What should I put into action-validation.xml?
> > > >
> > > > Taavi
> > > >
> > > >
> > > > -------------------------------------------------------
> > > > This SF.net email is sponsored by: SF.net Giveback Program. Does 
> > > > SourceForge.net help you be more productive?  Does it help you 
> > > > create better code?  SHARE THE LOVE, and help us help YOU!  Click 
> > > > Here: http://sourceforge.net/donate/ 
> > > > _______________________________________________
> > > > Opensymphony-webwork mailing list 
> > > > [EMAIL PROTECTED]
> > > > https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
> > > >
> > >
> > >
> > > -------------------------------------------------------
> > > This SF.net email is sponsored by: SF.net Giveback Program. Does 
> > > SourceForge.net help you be more productive?  Does it help 
> > you create 
> > > better code?  SHARE THE LOVE, and help us help YOU!  Click Here: 
> > > http://sourceforge.net/donate/ 
> > > _______________________________________________
> > > Opensymphony-webwork mailing list 
> > > [EMAIL PROTECTED]
> > > https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
> > >
> > 
> > 
> > 
> > -------------------------------------------------------
> > This SF.net email is sponsored by: SF.net Giveback Program. 
> > Does SourceForge.net help you be more productive?  Does it 
> > help you create better code?  SHARE THE LOVE, and help us 
> > help YOU!  Click Here: http://sourceforge.net/donate/ 
> > _______________________________________________
> > Opensymphony-webwork mailing list 
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
> > 
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: SF.net Giveback Program.
> Does SourceForge.net help you be more productive?  Does it
> help you create better code?  SHARE THE LOVE, and help us help
> YOU!  Click Here: http://sourceforge.net/donate/
> _______________________________________________
> Opensymphony-webwork mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
> 


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to