V
V
VladimirovJS2017-07-05 00:37:50
Bootstrap
VladimirovJS, 2017-07-05 00:37:50

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

2 answer(s)
Z
Zvezdocheteg, 2017-07-06
@Zvezdocheteg

You can do something like this https://codepen.io/Profiteer/pen/JJBMXW
Dumped for clarity, you can improve)

M
Maxim, 2017-07-05
@maxfarseer

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 question

Ask a Question

731 491 924 answers to any question