-5

Check format of a text field to be XX-XXXX

first two digits represent any value between 01-99 are acceptable values hyphen; last 4 digits represent any value between 0001 to 1,000

4

1 回答 1

0

尝试在未来更具体......我想我的问题是正确的,但我不确定。

试一试!不要忘记将“字段名”更改为您的字段名的实际名称。

   <validator type="requiredstring">
        <param name="fieldname">someThing</param>
        <message>Number Required.</message>
   </validator>

   <validator type="regex">
        <param name="fieldname">someThing</param>
        <param name="expression"><![CDATA[\d{2}-\d{4}]></param>
        <message>Number must be entered as 99-9999.</message>
   </validator>

这仅适用于格式化,不适用于第二个数字的最大值。

查看范围 1-1000 的正则表达式http://www.codeproject.com/Articles/206330/Learning-REGEX-regular-expression-in-the-most-easi

于 2012-05-26T14:21:31.133 回答