validator intRange

msemenkin <[email protected]>
Newsgroups gmane.comp.java.struts-menu.user
Message-ID <[email protected]>
Hi!

I need to validate integer value entered in 'year' field. This fied can be emty as well.

I use following rule in validation.xml
      <field property="year" depends="integer,intRange">
        <msg name="integer"  key="validator.numeric"/>
        <arg0 key="resumeBuilder.birthDayYear"/>
        <arg1 name="intRange" key="${var:min}" resource="false"/>
        <arg2 name="intRange" key="${var:max}" resource="false"/>
        <var>
          <var-name>min</var-name>
          <var-value>1900</var-value>
        </var>
        <var>
          <var-name>max</var-name>
          <var-value>2100</var-value>
        </var>
      </field>
But such rule doesn't allows me to leave this field empty. If I insert zero instead min value in rule declaration, than everything is ok, but it is not a solution for me. How can I use range limitation and allow to user leave this field empty using validation.xml rules.

Maxim.


-----------------------------------------------------------------------------------------------------------------
Broadband interface (RIA) + mail box saftey = <a href="http://Struts_Menu_Users_List.roomity.com">Roomity.com</a>
*Your* clubs, no sign up to read, ad supported; try broadband internet. ~~1125949887208~~
-----------------------------------------------------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.