? ? Pending

User tests: Successful: Unsuccessful:

avatar joomdonation
joomdonation
8 Jan 2023

Pull Request for Issue #39496.

Summary of Changes

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.

Testing Instructions

  1. Open the file administrator/components/com_content/forms/article.xml, add the below code after id field:
<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>
  1. Edit the file administrator/components/com_content/tmpl/article/edit.php, add this line of code below after this line https://github.com/joomla/joomla-cms/blob/4.2-dev/administrator/components/com_content/tmpl/article/edit.php#L66 to render the new field
<div class="row"><?php echo $this->form->getInput('status'); ?></div>
  1. Create a new article, try to save the article without choosing an option from the new field above

Actual result BEFORE applying this Pull Request

The form is submitted even the radio field is a required field.

Expected result AFTER applying this Pull Request

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.

Link to documentations

Please select:

  • No documentation changes for docs.joomla.org needed
  • No documentation changes for manual.joomla.org needed

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
5.00

avatar joomla-cms-bot joomla-cms-bot - change - 8 Jan 2023
Category Layout
avatar joomdonation joomdonation - open - 8 Jan 2023
avatar joomdonation joomdonation - change - 8 Jan 2023
Status New Pending
avatar samuelagus samuelagus - test_item - 9 Jan 2023 - Tested successfully
avatar samuelagus
samuelagus - comment - 9 Jan 2023

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.

avatar heelc29 heelc29 - test_item - 9 Jan 2023 - Tested successfully
avatar heelc29
heelc29 - comment - 9 Jan 2023

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.

avatar Quy Quy - change - 9 Jan 2023
Status Pending Ready to Commit
Labels Added: ?
avatar Quy
Quy - comment - 9 Jan 2023

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/39578.

avatar roland-d roland-d - change - 9 Jan 2023
Labels Added: ?
avatar roland-d roland-d - change - 9 Jan 2023
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
avatar roland-d roland-d - close - 9 Jan 2023
avatar roland-d roland-d - merge - 9 Jan 2023
avatar roland-d
roland-d - comment - 9 Jan 2023

Thank you

Add a Comment

Login with GitHub to post a comment