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