? Pending

User tests: Successful: Unsuccessful:

avatar astridx
astridx
1 Feb 2020

Pull Request for Issue # #27736.

Summary of Changes

I hid the require parameter in the Custom Field subfield.

Testing Instructions

  1. Create a custom field of the type subfield

  2. See that the parameter require is shown.
    Articles  New Field   test   Administration(1)

  3. Apply this patch and see, that the parameter require is not shown anymore.
    Articles  New Field   test   Administration

Expected result

If the option required is offered, the value of the field should have an impact.
In the case of a subfield, technically there is always a value. Therefore, the assignment of this option does not matter.

Actual result

The field is shown unnecessarily here.

Documentation Changes Required

Yes
https://docs.joomla.org/Custom_fields_type:_Subfields
https://docs.joomla.org/J3.x:Adding_custom_fields (Here the subfield is missing at all)

avatar joomla-cms-bot joomla-cms-bot - change - 1 Feb 2020
Category Front End Plugins
avatar astridx astridx - open - 1 Feb 2020
avatar astridx astridx - change - 1 Feb 2020
Status New Pending
avatar astridx astridx - change - 1 Feb 2020
Title
[4.0] Require
[4.0] Require parameter in custom field Subfield
avatar astridx astridx - edited - 1 Feb 2020
4f82d3c 2 Feb 2020 avatar astridx cs
avatar astridx astridx - change - 2 Feb 2020
Labels Added: ?
avatar richard67
richard67 - comment - 2 Feb 2020

@astridx When selecting another field type than "Subflields (subfields)" and setting "required" to "yes" and then changing field type to "Subflields (subfields)" while still editing the field (i.e. not having saved yet), the "required" field is hidden but the value is 1 and not 0. Is that a problem? As far as I understand it is no problem because the field value doesn't have any impact on function for that field type, but I ask just to be sure my understanding is right. @Fedik What do you think?

avatar astridx
astridx - comment - 2 Feb 2020

@richard67 As far as I understand it is no problem because the field value doesn't have any impact on function

Yes, if I have understood everything correctly, the subfield field is saved, regardless of whether require is 1 or 0.
You can only "make" the field as a mandatory field by specifying one of the field inside the subfield as a mandatory field.

avatar richard67 richard67 - test_item - 2 Feb 2020 - Tested successfully
avatar richard67
richard67 - comment - 2 Feb 2020

I have tested this item successfully on 4f82d3c

Works as promised: When selecting "subfields" as field type, the "required" switcher is hidden, and when selecting another field type the switcher it is shown.


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

avatar richard67
richard67 - comment - 2 Feb 2020

@Fedik Could you test, too?

avatar Fedik
Fedik - comment - 2 Feb 2020

When selecting another field type than "Subflields (subfields)" and setting "required" to "yes" and then changing field type to "Subflields (subfields)" while still editing the field (i.e. not having saved yet), the "required" field is hidden but the value is 1 and not 0. Is that a problem?

hm, it sounds like it may have a problem,
did you tried test it #27736 after that?

I cannot test currently, I try later this week

avatar richard67
richard67 - comment - 2 Feb 2020

@Fedik Will test later as described in the issue. Thanks for feedback.

avatar richard67
richard67 - comment - 2 Feb 2020

@Fedik I've just tested. First created a text field with required=no, then created a field where I first had set type type to text field and then had set required=yes and then had changed type to subfields and then saved. then created article and was allowed to save it with emtpy text field. then edited text field and set required to yes, then edited article and verified that i was not allowed to save it because required text field was empty. Finally filled in the required text field and was able to save. So to me it looks all ok.

avatar richard67
richard67 - comment - 2 Feb 2020

@Fedik Ah, maybe I should have mentioned that what I had found out above was in browser development tools when inspecting the html, not in database. I've tested again as you suggested, and it seems ok to me, see my previous comment.

avatar astridx
astridx - comment - 2 Feb 2020

@Fedik hm, it sounds like it may have a problem

I don't understand where you see the problem. For the subfield, it does not matter whether required is 1 or 0.
Am I missing something?

avatar richard67
richard67 - comment - 2 Feb 2020

@astridx Maybe he just misunderstood my comment because it was maybe a bit confusing.

avatar Fedik
Fedik - comment - 2 Feb 2020

@richard67 thanks for checking, btw, it was subform with multiple=yes or multiple=no?

I don't understand where you see the problem.

It just my assumption, because cannot check on my own currently ?
the idea if you change the field type, then "required=1" still stay, but not editable now,
so I have assume it can lead to this issue #27736

avatar richard67
richard67 - comment - 2 Feb 2020

@Fedik No, was subform with one text field only. Tested as described in my comment above.

avatar Fedik
Fedik - comment - 2 Feb 2020

With multiple=yes or multiple=no I mean this little switcher ?

screen 2020-02-02 19 38 33 424x88

Because it change behavior a bit.
Need to test both.

avatar richard67
richard67 - comment - 2 Feb 2020

Ah. Have to test later.

avatar Fedik
Fedik - comment - 7 Feb 2020

@richard67 I just tested, you were right after changing the field type the value required=1 stays,
however while validation it forced to required=0, and so the issue #27736 somehow fixed

strange, but okay

avatar Fedik Fedik - test_item - 7 Feb 2020 - Tested successfully
avatar Fedik
Fedik - comment - 7 Feb 2020

I have tested this item successfully on 4f82d3c


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

avatar Quy Quy - change - 7 Feb 2020
Status Pending Ready to Commit
avatar Quy
Quy - comment - 7 Feb 2020

RTC


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

avatar Quy
Quy - comment - 7 Feb 2020

RTC


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

avatar richard67
richard67 - comment - 7 Feb 2020

@richard67 I just tested, you were right after changing the field type the value required=1 stays,
however while validation it forced to required=0, and so the issue #27736 somehow fixed

strange, but okay

@Fedik Ive seen when I was working on global configuration and installation form for the database connection encryption that this seems to be the way we do. we don't reset fields to default values when hiding them because together with showon conditions and possible default values this can be very complicated. Instead of this we fix that in server side validation in PHP after form validation.

avatar rdeutz rdeutz - change - 7 Feb 2020
Status Ready to Commit Needs Review
avatar rdeutz
rdeutz - comment - 7 Feb 2020

this dosen't look right to me, removing rtc, I have too look into this again


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

avatar astridx
astridx - comment - 14 Mar 2020

As I do not have an idea for a change I close this.

avatar astridx astridx - close - 14 Mar 2020
avatar astridx astridx - change - 14 Mar 2020
Status Needs Review Closed
Closed_Date 0000-00-00 00:00:00 2020-03-14 09:42:21
Closed_By astridx

Add a Comment

Login with GitHub to post a comment