judgegem / judge

Client-side form validation for Rails
MIT License
256 stars 41 forks source link

SimpleForm Radio Buttons Not Validate #57

Closed danieldocki closed 9 years ago

danieldocki commented 9 years ago

Hi Guys,

I'm using SimpleForm. Judge return valid, but radio is not selected.

I suspect he returns valid because the tag 'value' has value, which is 'male' and 'female', have any solutions?

    <%= f.input :gender, required: true, collection: [[:male, t('male')],
      [:female, t('female')]], label_method: :last, value_method: :first,
      as: :radio_buttons, item_wrapper_class: 'radio-inline', validate: true %>
<div class="form-group radio_buttons required user_gender">
  <label class="radio_buttons required control-label">
    <abbr title="obrigatório">*</abbr> sexo
  </label>

  <span class="radio radio-inline radio__label">
    <input class="radio_buttons required form-control" 
      data-validate="[{&quot;kind&quot;:&quot;presence&quot;,&quot;options&quot;:{},&quot;messages&quot;:{&quot;blank&quot;:&quot;não pode ficar em branco&quot;}}]"
      data-klass="User" type="radio" value="male" name="user[gender]" id="user_gender_male">
    <label class="collection_radio_buttons" for="user_gender_male">papai</label>
  </span>

  <span class="radio radio-inline radio__label">
    <input class="radio_buttons required form-control"
      data-validate="[{&quot;kind&quot;:&quot;presence&quot;,&quot;options&quot;:{},&quot;messages&quot;:{&quot;blank&quot;:&quot;não pode ficar em branco&quot;}}]"
      data-klass="User" type="radio" value="female" name="user[gender]" id="user_gender_female">
    <label class="collection_radio_buttons" for="user_gender_female">mamãe</label>
  </span>
</div>

Thanks :)

jamesmk commented 9 years ago

Thanks for the bug report. I'm going to close this because it was already reported here: https://github.com/joecorcoran/judge/issues/33