The check does not show after antdesign uses the set of onvaluesChange and mapPropsToFields.

topic description

antdesign does not show

after using Form.create "s onvaluesChange and mapPropsToFields sets.

sources of topics and their own ideas

because of the linkage, I used onvaluesChange and mapPropsToFields, but found that all the check reds are not displayed. Some of them only show
in console. I have tried to use async-validator, to return a promise or a direct async,await, but after I return, for example,

.
{
validator: async (rules, value, callback) => {
    this.props.queryShopBankInfo(value)
    const result = await this.props.queryShopByShopId(value)
    console.log("result", result)
    callback(new Error("ID"))
    console.log(111)
 }
}

both the console above and the console below can be seen in the browser, but even this callback cannot be displayed
the following is not allowed

var descriptor = {
  contactPerson: {
    type: "string",
    required: true,
    message: "",
    validator (rule, value, callback) {
      if (value.trim() === "") {
        callback(new Error("aa"))
      }
    }
  }
}
var validator = new Schema(descriptor)
{getFieldDecorator("contactPerson", {
  rules: validator.rules.contactPerson,
  initialValue: (feeApplyInfo && feeApplyInfo.contactPerson) || ""
})(
  <Input
    placeholder="20"
  />
)}

related codes

/ / Please paste the code text below (do not replace the code with pictures)

{getFieldDecorator("targetNo", {
  rules: [{
    max: 30, message: "30"
  }, {
    required: true, message: ""
  }],
  initialValue: (feeApplyInfo && feeApplyInfo.targetNo) || ""
})(
  <Input placeholder="30" />
)}
onValuesChange (props, changedFields) {
    const names = Object.keys(changedFields)
    if (names.length !== 1) return
    let name = names[0]
        switch (name) {
         
      default:
        onUpdateCompensateApplyForm(name, changedFields[name])//
        // console.log("")
    }

what result do you expect? What is the error message actually seen?

I look forward to solving the verification problem of this form. (there is no such form verification problem with onchange)
and now, for example, I have no way in the input box. If I do not meet the verification rules, I will display it in scarlet letter directly, and only when I click the submit button of the form will I verify it as a whole (there will be no red letter error message on the page, but will only be displayed in console).
this is the way it is shown at present. It"s just this picture

clipboard.png

Dec.05,2021

have you solved it


have you solved

Menu