Answer the question
In order to leave comments, you need to log in
How to make Input disabled?
There are two inputs on the form. How to make it so that starting to enter in one Input, the second one becomes disabled I use react-bootstrap and the FormControl component for inputs from here https://react-bootstrap.github.io/components.html#...
that is I have two FormGroup components, inside each FormControl.
Answer the question
In order to leave comments, you need to log in
You can do something like this https://codepen.io/Profiteer/pen/JJBMXW
Dumped for clarity, you can improve)
You want the disabled attribute on an input to respond to a value in another. If both inputs are in the same component, then you can use state, and see if the state of the first input has a value, then the second is disabled, something like this:
<FieldGroup
id="formControlsText"
type="text"
label="Text"
placeholder="Enter text"
disabled={this.state.myOtherInputValue1}
/>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question