You can chain the attribute values of showon, using [AND], like so:
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:
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.
but showon attribute working only if I render the field using renderField function
Hope this helps someone facing the same issue
Man, although I'm not 100% sure, you should use:
The [AND] expects both to be true. This way your nested field should work.
(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;
class JFormFieldObjecttypes extends JFormFieldList
protected $type = 'Objecttypes';
public function getOptions(...