Validation

Each EasyEdit component can have its own custom validation rules, see examples below:

Input validation

The component below shows how easy it is to add a basic null check on the component's value. if the user attempts to save without adding any value in the field rendered, then they will see the validation message "Please provide a valid value" and the component will prevent them from saving. You can always change the validation message by passing in the message you would like in the validationMessage prop or overwrite the style by overwriting the css class easy-edit-validation-error

<EasyEdit
  type={Types.TEXT}
  onSave={(value) => {alert(value)}}
  onValidate={value => {return value != null}}
/>

Last updated