jurassix / react-validation-mixin

Simple validation mixin (HoC) for React.
MIT License
283 stars 38 forks source link

Custom error message #49

Closed agile116 closed 8 years ago

agile116 commented 8 years ago

Hi,

I have the following two dates fields defined in validatorTypes. I'd like to show error message like "START DATE must be earlier than END DATE." Is it possible and how? Thanks. startDate: Joi.date().max(Joi.ref('endDate')).required().label('START DATE'), endDate:Joi.date().required().label('END DATE'),

fbaiodias commented 8 years ago

Yes, checkout this page: https://jurassix.gitbooks.io/docs-react-validation-mixin/content/overview/custom.html

You could pass something like this as a language to startDate:

{
  date: {
    max: 'must be earlier than END DATE'
  }
}
agile116 commented 8 years ago

Thanks:)

杨小林

在 2015年10月14日,00:08,Francisco Baio Dias notifications@github.com 写道:

Yes, checkout this page: https://jurassix.gitbooks.io/docs-react-validation-mixin/content/overview/custom.html

You could pass something like this as a language to startDate:

{ date: { max: 'must be earlier than END DATE' } } — Reply to this email directly or view it on GitHub.

jurassix commented 8 years ago

@agile116 let us know if you need any additional help.

agile116 commented 8 years ago

Is it working now. Thanks

杨小林

在 2015年10月14日,22:23,Clint Ayres notifications@github.com 写道:

@agile116 let us know if you need any additional help.

— Reply to this email directly or view it on GitHub.