User tests: Successful: Unsuccessful:
Pull Request for Issue #41217.
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
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.
The user was able to save the field independent on what's in the showon attribute.
The user can only save the field when the showon rule is valid
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
Category | ⇒ | Administration com_fields Libraries |
Status | New | ⇒ | Pending |
Labels |
Added:
PR-5.0-dev
|
I have tested this item ✅ successfully on f402a7b
I have tested this item ✅ successfully on f402a7b
Tested succesfully, I got "Invalid field: Showon Attribute" when I entered something random
Tested successfully. Not sure if this needs documentation as it was a bug.
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.
Status | Pending | ⇒ | Ready to Commit |
RTC
Sorry, I should have explained it better, with tests I meant system tests and not manual testing.
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
|
thanks, adding a test for this would be great.
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
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.
@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?
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.
This should be backed up with tests, one reason is that this is some kind of documentation. And further more it needs documentation.