? Success

User tests: Successful: Unsuccessful:

avatar chivitli
chivitli
27 Mar 2014

This is like PR #3127, just in sync with the latest changes, and it also adds support for hidden labels on xml level. Here is the copy of the test instructions/description from the previous PR:

Overview

In the Joomla Global Configuration we use showon attribute to show/hide certain fields based on the state of a "parent" field. You can see this for example with the FTP settings where the settings itself only show when "Enable FTP" is set to "Yes". It's also available for Component settings.

This PR takes this feature to the JForm so it can be used in any xml file.

Testing

You can add a showon attribute to any config field you want to hide. For example in
modules\mod_finder\mod_finder.xml you add to line 94
showon="show_label:1". So it looks like this:

                <field
                    name="label_pos"
                    type="list"
                    default="left"
                    showon="show_label:1"
                    label="MOD_FINDER_FIELDSET_ADVANCED_LABEL_POS_LABEL"
                    description="MOD_FINDER_FIELDSET_ADVANCED_LABEL_POS_DESCRIPTION">
                    <option
                        value="right">JGLOBAL_RIGHT</option>
                    <option
                        value="left">JGLOBAL_LEFT</option>
                    <option
                        value="top">MOD_FINDER_CONFIG_OPTION_TOP</option>
                    <option
                        value="bottom">MOD_FINDER_CONFIG_OPTION_BOTTOM</option>
                </field>

This will only show the "Label position" setting only if the "Show Label" is set to "Yes" (which has the value 1).

Tracker: http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=33295&start=0

avatar chivitli chivitli - open - 27 Mar 2014
avatar chivitli chivitli - change - 27 Mar 2014
Title
Adding the "showon" & hiddenLabel feature to JForm
[#33295] Adding the "showon" & hiddenLabel feature to JForm
avatar wilsonge
wilsonge - comment - 27 Mar 2014

Looks good :) Will test this as soon as I get home tonight!

avatar wilsonge
wilsonge - comment - 27 Mar 2014

Looks good to me :) 1 more tester

P.S. Can you just edit the comment in the JLayout to reflect we're now passing in the options array rather than the $hiddenLabel please

avatar chivitli
chivitli - comment - 28 Mar 2014

Done.

avatar Bakual
Bakual - comment - 28 Mar 2014

Tested with module, plugin and template settings. Also verified that component and global config doesn't break.
Going to merge. Thanks!

avatar Bakual Bakual - change - 28 Mar 2014
Status New Closed
Closed_Date 0000-00-00 00:00:00 2014-03-28 07:48:18
avatar Bakual Bakual - close - 28 Mar 2014
avatar Bakual Bakual - close - 28 Mar 2014
avatar chivitli
chivitli - comment - 28 Mar 2014

Thanks!

avatar puneet0191 puneet0191 - reference | - 30 Mar 14
avatar Bakual Bakual - reference | - 12 May 14
avatar piotr-cz
piotr-cz - comment - 10 Apr 2015

There's a problem when showon attribute is applied to field inside a group, but target field is not within it.

<fieldset>
     <field
        name="has_full_image"
        type="radio"
    >
        <option value="yes">JYES</option>
        <option value="no">JNO</option>
    </field>
</fieldset>
<fields name="images">
    <field
        name="image_fulltext"
        showon="has_full_image:yes"
    />
</fields>

because the attached rel attribute is generating id from the source field:

<div class="control-group  showon_yes"  rel="showon_jform[images][has_full_image]">
...
</div>

Dirty workaround is to place both field withing same group

avatar zero-24
zero-24 - comment - 10 Apr 2015

@piotr-cz i guess we should open a new issue for this? I think here your comment get forgotten, as this is a closed / merged PR :smile:

avatar sovainfo
sovainfo - comment - 10 Apr 2015

@zero-24 Could you add it to milestone J342?

avatar zero-24
zero-24 - comment - 10 Apr 2015

@sovainfo what issue? ;) This PR gets merged into Joomla 3 and it is closed.

If we open a new Issue / PR i can add it to the milestone :smile:

avatar sovainfo
sovainfo - comment - 10 Apr 2015

And if it had been assigned to the proper milestone we would be able to see when it was committed. When reporting on the milestone it would show up.

avatar mbabker
mbabker - comment - 10 Apr 2015

Milestones didn't start getting used until 3.3.4-ish. Long after this PR was merged.

avatar sovainfo
sovainfo - comment - 10 Apr 2015

Sorry, misread the information: 28 march 2014 instead of 2015 !

avatar piotr-cz
piotr-cz - comment - 11 Apr 2015

I've created new issue #6744.
I made a comment here, because the original author of the PR may be best person to propose optimal solution.

avatar chivitli
chivitli - comment - 16 Apr 2015

I think @obsidev may be the best person to suggest a solution, as (s)he is the author of the original js which works out the targets

avatar obsidev
obsidev - comment - 16 Apr 2015

Hi,

The easier will be to allow the "showon" to specify the other ID ; not complicated at all.
I was talking with @garstud during a local Joomla event and we shared some ideas on the "showon" feature, it could be a good time to implement them !

Regards,

PS : It's a "he" :) I'm also know as Jerome from the HikaShop team.

avatar piotr-cz
piotr-cz - comment - 17 Apr 2015

@obsidev I agree this is the best option but this would break B/C

avatar DeathMark
DeathMark - comment - 18 May 2015

This solution doesn't work with field has multiple="true"

avatar Bakual
Bakual - comment - 18 May 2015

@DeathMark If you think this is an issue, please open a new issue on this tracker. A comment on an old closed one will only get lost in time and space.

avatar DeathMark
DeathMark - comment - 18 May 2015

@Bakual Thanks. I will do it.

avatar stutteringp0et
stutteringp0et - comment - 10 Apr 2016

Has anyone thought about multiple tests? Maybe something like showon="field1:1;field2:2" - requiring multiple values to align before the field is shown?

avatar ggppdk
ggppdk - comment - 10 Apr 2016

already included in 3.5.x
see here:
#8524

showon="field1:1[AND]field2:1[AND]field3:1"
showon="field1:1[AND]field2:1[OR]field3:1"

avatar stutteringp0et
stutteringp0et - comment - 10 Apr 2016

That's awesome! Thanks!

Add a Comment

Login with GitHub to post a comment