User tests: Successful: Unsuccessful:
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:
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.
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).
Title |
|
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
Done.
Tested with module, plugin and template settings. Also verified that component and global config doesn't break.
Going to merge. Thanks!
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2014-03-28 07:48:18 |
Thanks!
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
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.
Milestones didn't start getting used until 3.3.4-ish. Long after this PR was merged.
Sorry, misread the information: 28 march 2014 instead of 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.
This solution doesn't work with field has multiple="true"
@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.
Has anyone thought about multiple tests? Maybe something like showon="field1:1;field2:2" - requiring multiple values to align before the field is shown?
That's awesome! Thanks!
Looks good :) Will test this as soon as I get home tonight!