User tests: Successful: Unsuccessful:
Pull Request for Issue #39496.
Base on code at https://github.com/joomla/joomla-cms/blob/4.2-dev/build/media_source/system/js/fields/validate.es6.js#L192 and https://github.com/joomla/joomla-cms/blob/4.2-dev/build/media_source/system/js/fields/validate.es6.js#L194 , to validate a radio form field as required, the fieldset element in radio form field layout must has class attribute contains radio . The element also need to have required attribute or required in it's class.
Since required is not a valid attribute for fieldset element, I set class="required radio" when the field is required to address the issue.
<field name="status" id="status" type="radio" class="btn-group"
label="HISTORY_STATUS"
description="HISTORY_STATUS"
required="true"
default="0"
>
<option value="1">In Process</option>
<option value="2">Return</option>
<option value="3">Sent</option>
</field>
<div class="row"><?php echo $this->form->getInput('status'); ?></div>
The form is submitted even the radio field is a required field.
Form is not submitted, an error message like below will be displayed:
The form cannot be submitted as it's missing required data.
Please correct the marked fields and try again.
Please select:
Category | ⇒ | Layout |
Status | New | ⇒ | Pending |
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
Labels |
Added:
?
|
RTC
Labels |
Added:
?
|
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2023-01-09 18:34:07 |
Closed_By | ⇒ | roland-d |
Thank you
I have tested this item✅ successfully on 6481d66
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39578.