Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document radio and checkbox validation states #14010

Closed
zacechola opened this issue Jul 2, 2014 · 1 comment
Closed

Document radio and checkbox validation states #14010

zacechola opened this issue Jul 2, 2014 · 1 comment
Milestone

Comments

@zacechola
Copy link

#10522 added contextual validation states to .radio, .checkbox, .radio-inline and .checkbox-inline.

However, the docs are a bit unclear on what needs to be done to add the classes:

Bootstrap includes validation styles for error, warning, and success states on form controls. To use, add .has-warning, .has-error, or .has-success to the parent element. Any .control-label, .form-control, and .help-block within that element will receive the validation styles.

Mainly at issue is adding the has-* contextual classes to the "parent" element. Parent to what? In the case of labels, it's the parent to the .control-label , as 15c7e5f makes clear.

So adding the following doesn't work (nor do I think it makes much sense):

<div class="checkbox has-error">
  <label>
    <input type="checkbox" value="">
    Option one is this and that—be sure to include why it's great
  </label>
</div>

The above case is a copy of the the docs for checkboxes, which don't have (or need) the .control-label class on the label.

A solution would be to add the .control-label class to the label:

<div class="checkbox has-error">
  <label class="control-label">
    <input type="checkbox" value="">
    Option one is this and that—be sure to include why it's great
  </label>
</div>

But what is more likely the desired behavior is to target a group of inputs, where a div with the contextual class wraps the entire group of inputs:

<div class="has-warning">
  <label class="checkbox-inline">
    <input type="checkbox" id="inlineCheckbox1" value="option1"> 1
  </label>
  <label class="checkbox-inline">
    <input type="checkbox" id="inlineCheckbox2" value="option2"> 2
  </label>
  <label class="checkbox-inline">
    <input type="checkbox" id="inlineCheckbox3" value="option3"> 3
  </label>
</div>

This is a long post to start a (hopefully) brief discussion about which way to document this, if at all.

@cvrebert cvrebert added this to the v3.2.1 milestone Jul 2, 2014
zacechola pushed a commit to zacechola/bootstrap that referenced this issue Jul 2, 2014
References twbs#14010

fixing duped IDs

fix ALL the duped IDs.

make example id match actual id
@cvrebert
Copy link
Collaborator

cvrebert commented Jul 3, 2014

Closing since #14011 was merged.

@cvrebert cvrebert closed this as completed Jul 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants