I’m using ReactJs as a frontend library. Actually I want to condition the display of a field in my form.
the field that I want to condition its display is “long_escalier”
I want to said : If(floor_no !=”rée de chanssée){ dispaly the field of long_escalier}
This is my code:
<Form className='mt-2 pt-50'>
<Row>
<Col sm='12' className='mb-1'>
<Label className='form-label' for='name'>
Floor Number <span className='text-danger'>*</span>
</Label>
<input type='text' className="form-control"
onChange={(e) =>
setFloorno(e.target.value)
}
placeholder="floor no" />
<small className='text-danger'>{errorList.floor_no}</small>
<br />
</Col>
</Row>
<Row>
<Col sm='12' className='mb-1'>
<Label className='form-label' for='long_escalier'>
Longueur Escalier <span className='text-danger'>*</span>
</Label>
<input type='text' className="form-control"
onChange={(e) =>
setLongEscalier(e.target.value)
}
placeholder="Stair length" />
<small className='text-danger'>{errorList.long_escalier}</small>
<br/>
</Col>
</Row>
<Row>
<Col sm='12' className='mb-1'>
<Label className='form-label' for='dispo_ascenseur'>
Elevator availability
<span className='text-danger'>*</span>
</Label>
<select id='dispo_ascenseur' className='form-control' onChange={(e) => setAscenseur(e.target.value)}>
<option value='disponible'> Disponible </option>
<option value='non disponible'> Non Disponible </option>
</select>
<small className='text-danger'>{errorList.dispo_ascenseur}</small>
<br/>
</Col>
</Row>
<Button onClick={addFloor} className='me-1' color='primary'>
Submit
</Button>
<Button type='reset' color='secondary'>
Cancel
</Button>
</Form>
And thanks for advance for anyone will help me