Noitidart
Noitidart

Reputation: 37328

Get error values of fields

I wanted to get the error values for the names of all the fields in my form. I wanted to show a "form-level" error saying "you need to go look at this field" and clicking individual messages will scroll them to that field.

I haven't been able to figure out how to get anything other then the "form-level" error from this.props.error.

Upvotes: 0

Views: 162

Answers (1)

Dario
Dario

Reputation: 6280

I had a similar requirement and I used getFormSyncErrors selector which returns an object whose keys are the name of the invalid fields and whose values are the corresponding error:

{
  recipientAddress: "Required", 
  recipientCity: "Required", 
  recipientZip: "Required"
}

Upvotes: 1

Related Questions