? Documentation Required bug PR-5.0-dev Pending

User tests: Successful: Unsuccessful:

avatar MagnusSinger
MagnusSinger
26 Aug 2023

Pull Request for Issue #41217.

Summary of Changes

Added a new input rule in oder to check if the show on input text is valid. If not, the user is unable to safe the field

Testing Instructions

Create a new custom field and edit the Showon Attribute. Enter something invalid and you should be unable to save. If you enter something valid, the field can be saved.

Actual result BEFORE applying this Pull Request

The user was able to save the field independent on what's in the showon attribute.

Expected result AFTER applying this Pull Request

The user can only save the field when the showon rule is valid

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

avatar joomla-cms-bot joomla-cms-bot - change - 26 Aug 2023
Category Administration com_fields Libraries
avatar MagnusSinger MagnusSinger - open - 26 Aug 2023
avatar MagnusSinger MagnusSinger - change - 26 Aug 2023
Status New Pending
avatar rdeutz
rdeutz - comment - 26 Aug 2023

This should be backed up with tests, one reason is that this is some kind of documentation. And further more it needs documentation.

avatar MagnusSinger MagnusSinger - change - 26 Aug 2023
Labels Added: PR-5.0-dev
avatar chmst chmst - test_item - 26 Aug 2023 - Tested successfully
avatar chmst
chmst - comment - 26 Aug 2023

I have tested this item ✅ successfully on f402a7b


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

avatar crommie crommie - test_item - 26 Aug 2023 - Tested successfully
avatar crommie
crommie - comment - 26 Aug 2023

I have tested this item ✅ successfully on f402a7b

Tested succesfully, I got "Invalid field: Showon Attribute" when I entered something random


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

avatar chmst
chmst - comment - 26 Aug 2023

Tested successfully. Not sure if this needs documentation as it was a bug.


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

avatar richard67
richard67 - comment - 26 Aug 2023

Not sure if this needs documentation as it was a bug.

It adds a new validation rule, so it the available validation rules are listed somewhere in our documentation or are even described, this needs to be extended by the new rule.

avatar richard67 richard67 - change - 26 Aug 2023
Status Pending Ready to Commit
avatar richard67
richard67 - comment - 26 Aug 2023

RTC


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

avatar rdeutz
rdeutz - comment - 26 Aug 2023

Sorry, I should have explained it better, with tests I meant system tests and not manual testing.

avatar HLeithner HLeithner - change - 2 Sep 2023
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2023-09-02 18:01:25
Closed_By HLeithner
Labels Added: ? Documentation Required bug
avatar HLeithner HLeithner - close - 2 Sep 2023
avatar HLeithner HLeithner - merge - 2 Sep 2023
avatar HLeithner
HLeithner - comment - 2 Sep 2023

thanks, adding a test for this would be great.

avatar obuisard
obuisard - comment - 20 Sep 2023

Should work:
box:value1
box!:value1
box!:
box:value1[OR]square:value1
box:value1[AND]square:value1
box:value1[OR]square!:value1
box:value1[AND]square!:value1
box:value1[AND]square:value1,value2
box:value1[AND]square!:value1,value2

Should fail:
tada,
box::,
box:!,
box:3:21,
[AND]box:value3[OR]tada:2:3

avatar richard67
richard67 - comment - 25 Sep 2023

@obuisard box!: (without a value specified) is currently failing, see issue #41788 .

avatar richard67
richard67 - comment - 25 Sep 2023

And box:3:21 and [AND]box:value3[OR]tada:2:3 pass the regex but they should fail. But this might be due to me having tested this with the complete regex and rule string using https://www.functions-online.com/preg_match.html , so I haven't cut the rule into parts separated by the AND and OR conditions like the code does. I've meanwhile done a real test, and they still pass, but they should fail.

avatar richard67
richard67 - comment - 25 Sep 2023

Am working on a fix, see #41918 . But I have to test it myself first. So it's still draft.

avatar richard67
richard67 - comment - 25 Sep 2023

@MagnusSinger What I don't understand it the $andRules = explode('&', $value); and the $orRules = explode('|', $andRule);. When I debug the value of the $value variable, it doesn't contain &or |, it contains [AND] and [OR] instead. Can it be that there is some "str_replace" missing for that? I think this thing is the reason why the [AND]box:value3[OR]tada:2:3 is detected to be valid, but it shouldn't?

avatar richard67
richard67 - comment - 25 Sep 2023

When fixing my previous comment by using $andRules = explode('[AND]', $value); and $orRules = explode('[OR]', $andRule);, the issue with [AND]box:value3[OR]tada:2:3 is solved. But the box:3:21 is not solved yet.

avatar richard67
richard67 - comment - 25 Sep 2023

I've fixed all these issues mentioned above. See #41918 .

avatar richard67
richard67 - comment - 25 Sep 2023

Sorry, I should have explained it better, with tests I meant system tests and not manual testing.

@rdeutz This PR here and my fix are things to be tested by unit tests, not by system tests.

Add a Comment

Login with GitHub to post a comment