dimanche 22 janvier 2017

Checkbox cannot get a param when I mixed it with text box for the same name input in a form

I want checkboxes for user to define the length they need. It could be 11, 13, 15 or custom which they can type into the text box. However, when I test by clicking one checkbox, it does not capture 11, 13 or 15 (but if I type the number in the text box, I get that "length"=>"number",). How to mix checkbox and text for input type in the the form.

/.html.erb

<div class="form-group" id="div_checkbox2">
  <label class="control-label col-sm-3" for="checkbox">
   Length :
  </label>
  <div class="col-sm-8 ">
   <label class="checkbox-inline">
    <input name="length" type="checkbox" value="11"/>
    11
   </label>
   <label class="checkbox-inline">
    <input name="length" type="checkbox" value="13"/>
    13
   </label>
   <label class="checkbox-inline">
    <input name="length" type="checkbox" value="15"/>
    15
   </label>
   <label class="checkbox-inline">
    <input name="length" type="text" maxlength="2" style="border-radius: 5px; height: 25px; width: 25px"/>
    custom (odd number only)
   </label>
  </div>
 </div>




Aucun commentaire:

Enregistrer un commentaire