redux-form验证:最小长度和匹配的密码

时间:2018-12-16 06:15:17

标签: reactjs redux redux-form

我正在尝试验证匹配的密码并确认密码和最小输入长度。这是我的代码:

(SELECT ph.ItemCode, ph.QuantityPurchased AS LastQtyPur FROM po_purchaseshistory ph WHERE ph.QuantityPurchased != 0 ORDER BY ph.ReceiptDate DESC LIMIT 1) AS MQ

我不知道为什么它不起作用。这是我的验证码:

<Field
              name='password'
              label='Password'
              component={renderField}
              as={Form.Input}
              type='password'
              icon='lock'iconPosition='left'
              placeholder='Password'
              validate={[minLength(5), required ]}/>
              <Field
                  name='password1'
                  label='Confirm Password'
                  icon="lock" iconPosition='left'
                  component={renderField}
                  as={Form.Input}
                  type='password'

                  placeholder='Confirm'
                  validate={[passwordValidate, required ]}/>

1 个答案:

答案 0 :(得分:0)

即使遇到同样的问题,也请尝试此操作。希望它也对您有用。

const minLengthName = minLength(5);

现在通话验证如下:

validate={[minLengthName, required ]}