Hot answers tagged


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 chain too, adding more complexity, for example: showon="field1:1[AND]field2:1[OR]fieldX:1" Update for Joomla 3.7: As of Joomla 3.7, you will be able to to ...


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 $this->form->renderField('field2'); Hope this helps someone facing the same issue


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


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"> </field> The [AND] expects both to be true. This way your nested field should work.


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 results will be used as the deciding factor. eg: foo:1[AND]bar:2[OR]bar:3 is effectively shortened to bar:2[OR]bar:3. Not what you want.


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; FormHelper::loadFieldClass('list'); class JFormFieldObjecttypes extends JFormFieldList { protected $type = 'Objecttypes'; public function getOptions(...

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