I was just going through the React-bootstrap form what is the use of controlId
is it similar to name
we use in legacy form?
<form> <FormGroup controlId="formBasicText" ---------------------->> what is the use? validationState={this.getValidationState()} > <ControlLabel>Working example with validation</ControlLabel> <FormControl type="text" value={this.state.value} placeholder="Enter text" onChange={this.handleChange} /> <FormControl.Feedback /> <HelpBlock>Validation is based on string length.</HelpBlock> </FormGroup> </form>
Sets id on <FormControl> and htmlFor on <FormGroup. Label> . Basically it's the input's id and the label's for attribute.
controlId: It is used to set the id on <FormControl> and htmlFor on <FormGroup. Label> component.
Create horizontal forms with the grid by adding as={Row} to form groups and using Col to specify the width of your labels and controls. Be sure to add the column prop to your FormLabel s as well so they're vertically centered with their associated form controls.
As the DOCS says:
Sets id on
<FormControl>
andhtmlFor
on<FormGroup.Label>
.
Basically it's the input's id
and the label's for
attribute.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With