Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot #38

Closed
asafshen opened this issue Sep 1, 2016 · 1 comment
Closed

Cannot #38

asafshen opened this issue Sep 1, 2016 · 1 comment

Comments

@asafshen
Copy link

asafshen commented Sep 1, 2016

Hi,

Im trying to make an Select component that integrate with React-Formsy.

in order to do so - I want to pass the <input ../> component an required=true property (supported via select's inputProps).

<Select
    name="form-field-name"
    value="one"
    options={options}
    onChange={logChange}
     inputProps={{
              required: true,
              otherField: true
      }}

  />

var options = [
    { value: 'one', label: 'One' },
    { value: 'two', label: 'Two' }
];

function logChange(val) {
    console.log("Selected: " + val);
}

When I inspect the components in react chrome debugger - I can see that otherField: true but required: false.

As a matter of fact - all other props are propagated well to <input> except required.

Any Suggestions?

Thanks.

@TrevorBurnham
Copy link
Contributor

Yes, required is indeed overridden by react-select:

required: this.state.required,
You can't control it directly. You can only set required={true} on the <Select> component, in which case required will be true on the <input> if and only if no value is set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants