foxhound87 / mobx-react-form

Reactive MobX Form State Management
https://foxhound87.github.io/mobx-react-form
MIT License
1.1k stars 129 forks source link

How to set error message when required field is missing? #213

Closed liveresume closed 7 years ago

liveresume commented 7 years ago

It seems that setting a 'required' rule does not result in an error message when value is missing.

const rules = {
  'name': 'required|string|between:10,75',
}

How can I set a custom message?

Since everything else results in an error message, doesn't it make sense to add as package default?

foxhound87 commented 7 years ago

required error is working in my case.

To set custom messages depends on the plugin you are using. We discussed here: https://github.com/foxhound87/mobx-react-form/issues/49

liveresume commented 7 years ago

What message are you getting?

Try updating to the latest version of validatorjs. What version are you on?

foxhound87 commented 7 years ago

"validatorjs": "3.11.0"

The message is "The Username field is required."

liveresume commented 7 years ago

looks like the update fixed it