How to get previous value of field in ant design?

Viewed 43

I have a following field in as part of my form.

          <Col span={18}>
            <Form.Item
              name="name"
              label="Name"
              colon={false}
              validateTrigger={"onBlur"}
              hasFeedback
              rules={[
                {
                  validator: nameValidator,
                  message: 'Name is not unique',
                },
              ]}
              labelCol={{ span: 2 }}
              wrapperCol={{ span: 22 }}
            >
               <Input placeholder="Enter name" />
            </Form.Item>
          </Col>

what i want to achieve is validation not to be triggered every time i focus and blur on my field without changing value of it. Is there any ways of getting previous value of the field ?

1 Answers

I think what you describe can be achieved by validateTrigger="onChange" - no need to access a previous value.

Related