User tests: Successful: Unsuccessful:
Fixed OptionsRule validation to support groupedlist fields by iterating through <group> children to find nested options.
Create a groupedlist field with validate="options", submit with valid value, and verify validation passes.
<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>Test the validation:
Verify the result:
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.
Validation passes for valid options within any group. The rule now correctly iterates through both direct options and options nested within group elements.
| Status | New | ⇒ | Pending |
| Category | ⇒ | Libraries |
| Labels |
Added:
PR-5.4-dev
|
||
Ah no, ignore my comment, I mixed up with the Field, but this is only validation.
Sorry for confusion.
Ah no, ignore my comment, I mixed up with the Field, but this is only validation.
Sorry for confusion.
No worries 😅
@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)
I have tested this item ✅ successfully on 705dcaf
This is new feature and should go to
6.1-dev.The documentation update is needed.
Suggested changes not going to work reliable. Following will not be rendered properly: