When a set of radio buttons are required the error class only gets added to the first button.

Example:

<div id="edit-submitted-contact-preferences-contact-preferences-email" class="form-radios">
  <div class="form-item form-type-radio"> 
    <input required="required" type="radio" name="submitted[contact_preferences][contact_preferences_email]" value="y" class="form-radio error">  
    <label class="option" for="edit-submitted-contact-preferences-contact-preferences-email-1">Yes </label>
  </div>

  <div class="form-item form-type-radio">
    <input required="required" type="radio" name="submitted[contact_preferences][contact_preferences_email]" value="n" class="form-radio">  
    <label class="option" for="edit-submitted-contact-preferences-contact-preferences-email-2">No </label>
  </div>
</div>

I would expect that the class gets added to both of the inputs.

Comments

mwhelan created an issue. See original summary.

sandip27’s picture

Status: Active » Closed (works as designed)

@mwhelan, I have tried both, Custom Form creation and marking radio buttons as required as well as through the Content Type. And in both the cases the class="form-radio error" is successfully getting applied to both the radio buttons.

Please post some more findings to reproduce the issue and change the Status of issue. For now, I am marking issue as not reproducible and working as expected.

I have tested it on "7.51-dev" branch.

Below is a code pasted for your reference.

<div class="form-item form-type-radios form-item-gender">
  <label for="edit-gender">gender <span class="form-required" title="This field is required.">*</span></label>
 <div id="edit-gender" class="form-radios"><div class="form-item form-type-radio form-item-gender">
 <input type="radio" id="edit-gender-0" name="gender" value="0" class="form-radio error">  <label class="option" for="edit-gender-0">Male </label>

</div>
<div class="form-item form-type-radio form-item-gender">
 <input type="radio" id="edit-gender-1" name="gender" value="1" class="form-radio error">  <label class="option" for="edit-gender-1">Female </label>

</div>
</div>
<div class="description">Select Gender.</div>
</div>

Thanks

sandip27’s picture

sandip27’s picture

Assigned: Unassigned » sandip27
Status: Closed (works as designed) » Fixed
sandip27’s picture

Assigned: sandip27 » Unassigned

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

macaronibros’s picture

StatusFileSize
new10.03 KB

Same issue experienced here.
As you may see visually from the attached screenshot, where a radio has been submitted without any value,
and there .error class is rendered with a red outer glow.