I am using ant design
in my demo application.(我在演示应用程序中使用了ant design
。)
dynamic validation
of mobile number in my application.(我想在应用程序中添加手机号码的dynamic validation
。)
In my form there two field(在我的表格中有两个字段)
select field(选择栏位)
input field(输入栏)
I want to add validation in the input field when select field
in mobile
(mobile number should be 10 digits).in other words I want to add validation of mobile number on input field only when user select mobile
from select box(我想在mobile
select field
(手机号码应为10位数)时在输入字段中添加验证。换句话说,我只想在用户从选择框中选择mobile
时在输入字段中添加手机号码的验证)
https://ant.design/components/form/(https://ant.design/components/form/)
here is my code https://codesandbox.io/s/holy-voice-o4wbj(这是我的代码https://codesandbox.io/s/holy-voice-o4wbj)
<Form.Item>
{getFieldDecorator("value", {
rules: [
{ required: true, message: "Please input search value!" },
{ pattern: /[2-9]{2}d{8}/, message: "Please input !" }
]
})(
<Input
style={{ width: 180 }}
// prefix={<Icon type="user" style={{color: 'rgba(0,0,0,.25)'}}/>}
placeholder="searchValue"
/>
)}
</Form.Item>
can we add this validation ?(我们可以添加此验证吗?)
ask by user944513 translate from so