简体   繁体   English

什么是 react-bootstrap 中的 controlId

[英]what is a controlId in react-bootstrap

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?我刚刚浏览了React-bootstrap 表单controlId的用途是什么,它与我们在遗留表单中使用的name相似吗?

<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>

As the DOCS says:正如DOCS所说:

Sets id on <FormControl> and htmlFor on <FormGroup.Label> .上设定为ID <FormControl>htmlFor<FormGroup.Label>

Basically it's the input's id and the label's for attribute.基本上它是输入的id和标签的for属性。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM