0

I've noticed that customized form components are automatically rendered with the has-success attribute. Why is this? Is there a way to fix this?

Wilhelm
  • 1,407
  • 5
  • 16
  • 32

1 Answers1

0

By default, errors are not shown and when a user submits the form, validation happens. But if you want has-error classes in all fields with invalid data, simply call this.props.form.validateFields() in componentDidMount method which will run validation and will add css classes to fields according to rules.

Zohaib Ijaz
  • 21,926
  • 7
  • 38
  • 60
  • This is an answer to a question that wasn't asked. The class attribute of a standard form field is `class="ant-form-item-control"`. However, the class attribute of customized form field is `class="ant-form-item-control has-success"`. Why are customized form fields being pre-validated as `has-success`? How do I fix/prevent this? – Wilhelm May 17 '19 at 04:59