Hot answers tagged

19 votes
Accepted

Form field "showon" with multiple fields

You can chain the attribute values of showon, using [AND], like so: showon="field1:1[AND]field2:1" Adding more fields to the chain is also allowed. On a side note, you can use an [OR] clause in the ...
  • 26.5k
8 votes
Accepted

JForm showon attribute does not work in admin site

Found what the issue is. I was using getInput function to show the field. $this->form->getInput('field2'); but showon attribute working only if I render the field using renderField function $...
  • 2,971
5 votes
Accepted

Form Field showon:"empty

Yes it is possible to do this: showon="foo!:"
3 votes
Accepted

Showon with nested fields?

Man, although I'm not 100% sure, you should use: <field name="nested" type="text" default="" showon="main:1[AND]sub:1" label="LABEL" description="DESC"> </...
2 votes
Accepted

Showon="foo:1[AND][bar:2[OR]bar:3]"

update (removed my incorrect answer) I was looking at the JS that parses these showons and it seems that using more than one AND/OR chain isn't going to produce correct results. Only the last pair's ...
  • 890
2 votes
Accepted

Does Showon attribute for list options work with Joomla 4?

Finally I manage to get this working in my component. I needed to add the javascript in the layout, like this: $wa = $this->document->getWebAssetManager(); $wa->useScript('showon');
  • 227
2 votes

Form-Fields-Fieldset-showon issue

showon indeed works only within the same fieldset. The javascript related with the showon, can handle fields from different groups/fieldsets. The problem resides in the php logic of the FormField ...
  • 151
1 vote
Accepted

Custom field type with showon attribute for list options

This is what I finally did. If someone knows a cleaner solution please let me know. defined('JPATH_BASE') or die; use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; use Joomla\CMS\Form\FormHelper; ...
  • 341

Only top scored, non community-wiki answers of a minimum length are eligible