Skip to content

Conversation

@Shauryan0207
Copy link
Contributor

@Shauryan0207 Shauryan0207 commented Dec 23, 2025

Summary of Changes

Fixed OptionsRule validation to support groupedlist fields by iterating through <group> children to find nested options.

Testing Instructions

Create a groupedlist field with validate="options", submit with valid value, and verify validation passes.

Steps to Test

  1. Create a test plugin with a groupedlist field:
    • Go to System → Plugins → Create a test plugin XML file with this field definition:
<field
    name="test_grouped"
    type="groupedlist"
    label="Test Grouped Field"
    validate="options"
>
    <option value="">Select Option</option>
    <group label="Group 1">
        <option value="option1">Option 1</option>
        <option value="option2">Option 2</option>
    </group>
    <group label="Group 2">
        <option value="option3">Option 3</option>
        <option value="option4">Option 4</option>
    </group>
</field>
  1. Test the validation:

    • Open the plugin configuration
    • Select a valid option from any group (e.g., "Option 2" or "Option 3")
    • Click Save
  2. Verify the result:

    • BEFORE this PR: You would get "Invalid field: test_grouped" error
    • AFTER this PR: The field saves successfully without validation errors

Actual result BEFORE applying this Pull Request

Validation fails with "Invalid field" error even when selecting valid grouped options because OptionsRule only checked direct <option> children and ignored options nested inside <group> elements.

Expected result AFTER applying this Pull Request

Validation passes for valid options within any group. The rule now correctly iterates through both direct options and options nested within group elements.

Link to documentations

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

@Shauryan0207 Shauryan0207 marked this pull request as draft December 23, 2025 09:07
@Shauryan0207 Shauryan0207 force-pushed the fix-44109-groupedlist-options-validation branch from a1f3907 to 716cbed Compare December 23, 2025 09:12
@Shauryan0207 Shauryan0207 marked this pull request as ready for review December 23, 2025 09:12
@Shauryan0207 Shauryan0207 force-pushed the fix-44109-groupedlist-options-validation branch from 716cbed to 705dcaf Compare December 23, 2025 09:20
@Fedik Fedik added the Feature label Dec 23, 2025
@Fedik

This comment was marked as outdated.

@Fedik Fedik removed the Feature label Dec 23, 2025
@Shauryan0207 Shauryan0207 changed the base branch from 5.4-dev to 6.1-dev December 23, 2025 09:31
@Shauryan0207 Shauryan0207 requested a review from laoneo as a code owner December 23, 2025 09:31
@Shauryan0207 Shauryan0207 marked this pull request as draft December 23, 2025 09:32
@Fedik
Copy link
Member

Fedik commented Dec 23, 2025

Ah no, ignore my comment, I mixed up with the Field, but this is only validation.

Sorry for confusion.

@Shauryan0207 Shauryan0207 changed the base branch from 6.1-dev to 5.4-dev December 23, 2025 09:33
@Shauryan0207
Copy link
Contributor Author

Ah no, ignore my comment, I mixed up with the Field, but this is only validation.

Sorry for confusion.

No worries 😅

@Shauryan0207 Shauryan0207 marked this pull request as ready for review December 23, 2025 09:34
@Fedik Fedik added the bug label Dec 23, 2025
@richard67
Copy link
Member

richard67 commented Dec 23, 2025

@Fedik As you have labelled this PR as feature: Should it be rebased to 6.1-dev? Ah, I just see you've changed it to bug.

@exlemor
Copy link

exlemor commented Dec 24, 2025

@Shauryan0207 Hi Shauryan, I tried to create a plugin but for those of us who are not coders, that's not so simple, I didn't succeed (I asked AI, it created me a simple plugin but when I used it to test your PR, I couldn't replicate the BEFORE condition so didn't work and I can't say I trust AI for this purpose) - so that I could gladly test your PR, can you add in the testing instructions a .zip file of the test plugin? (thanks)

@ceford
Copy link
Contributor

ceford commented Jan 6, 2026

I have tested this item ✅ successfully on 705dcaf


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

1 similar comment
@heelc29
Copy link
Contributor

heelc29 commented Jan 12, 2026

I have tested this item ✅ successfully on 705dcaf


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

@richard67 richard67 removed the bug label Jan 12, 2026
@richard67
Copy link
Member

RTC


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Jan 12, 2026
@richard67 richard67 added the bug label Jan 12, 2026
@richard67
Copy link
Member

System test failure is not related to this PR.

@muhme
Copy link
Contributor

muhme commented Jan 14, 2026

✅ Final test before merge with JBT

  • Created and installed plg_system_groupedlisttest.zip
  • Seen error 'Invalid field: Test Grouped Field' before PR
  • Applied PR with Patch Tester
  • Grouped options can be saved, and the selected parameters are correctly stored in the __extensions table
  • Checked Joomla logs

@muhme muhme merged commit 2c1d167 into joomla:5.4-dev Jan 14, 2026
69 checks passed
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Jan 14, 2026
@muhme muhme added this to the Joomla! 5.4.3 milestone Jan 14, 2026
@muhme
Copy link
Contributor

muhme commented Jan 14, 2026

Thank you @Shauryan0207 for your contribution.

Thank you @richard67 and @heelc29 for supporting this PR.

Thank you @ceford and @heelc29 for testing.

@exlemor, plg_system_groupedlisttest.zip has now been added. It's a bit late, but thank you for trying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants