2

I have TextField<Integer> and i want to validate that the input contain exactly 8 digit. if it was TextField<String> i would simply add a PatternValidator("(\\d){8}") to it but PatterValidator extends IValidator and I cant add it to TextField<Integer>

how can i validate this textField. i need to use TextField<Integer> because this component automatically convert all numbers in UTF8 to Integer

4

1 回答 1

2

您可以附加RangeValidator并设置您正在寻找的范围。它不应更改 html 并将在表单提交时进行验证。

RangeValidator.range(10000000, 99999999);
于 2013-08-04T15:36:52.420 回答