@R_301_323@
您可以使用
pattern
attribute.也需要
required
attribute,否则具有空值的输入字段将从
constraint validation中排除。
<input pattern=".{3,}" required title="3 characters minimum"> <input pattern=".{5,10}" required title="5 to 10 characters">
如果要创建将此模式用于“空或最小长度”的选项,可以执行以下操作:
<input pattern=".{0}|.{5,10}" required title="Either 0 OR (5 to 10 chars)"> <input pattern=".{0}|.{8,}" required title="Either 0 OR (8 chars minimum)">