React-select: Customize native validation message

Created on 16 Nov 2017  路  1Comment  路  Source: JedWatson/react-select

Feature request

Customize native validation message

Similar to this example https://stackoverflow.com/questions/5272433/html5-form-required-attribute-set-custom-validation-message

<input type="text" id="username" required placeholder="Enter Name"
    oninvalid="this.setCustomValidity('Enter User Name Here')"
    oninput="setCustomValidity('')"  />

Fiddle https://jsfiddle.net/ytuee7wr/

image

Most helpful comment

Closing this, sorry i have achieved this by passing inputProps

<Select
  inputProps={{
    onInvalid: (e) => e.target.setCustomValidity('Invalid Custom message'),
    onInput: (e) => e.target.setCustomValidity(''),
  }}
/>

>All comments

Closing this, sorry i have achieved this by passing inputProps

<Select
  inputProps={{
    onInvalid: (e) => e.target.setCustomValidity('Invalid Custom message'),
    onInput: (e) => e.target.setCustomValidity(''),
  }}
/>
Was this page helpful?
0 / 5 - 0 ratings