Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Hot answers tagged

15

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 ...


6

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


4

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


3

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.


2

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.


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