simple-react-validator icon indicating copy to clipboard operation
simple-react-validator copied to clipboard

Validation message shows field names in lowercase always!

Open rajat-arora084 opened this issue 1 year ago • 1 comments

When I try to show validation messages on a field. It shows the field name in lowercase. Can it be shown as per the field name?

Example: My field name is: Mobile Number

image

rajat-arora084 avatar Aug 04 '23 11:08 rajat-arora084

class NewSimpleReactValidator extends SimpleReactValidator {
  constructor(options = {}) {
    super(options);

    this.helpers.humanizeFieldName = (field) => {
      // startCase is a Lodash method
      return _.startCase(field.replace(/([a-z0-9])([A-Z])/g, '$1 $2').replace(/_/g, ' '));
    }
  }
}

fxgit avatar Sep 27 '23 23:09 fxgit