Use showon in an XML-field-declaration in frontend like this:
<field name = "title"
type = "list"
label = "COM_BESTIA_FIELDS_USERTITLE_LABEL"
description = "COM_BESTIA_FIELDS_USERTITLE_DESC"
filter = "safehtml"
default = "">
<option value = "">COM_BESTIA_FIELDS_VALUES_NOTITLE</option>
<option value = "other">COM_BESTIA_FIELDS_VALUES_OTHERTITLE</option>
<option value = "dr">COM_BESTIA_FIELDS_VALUES_DR</option>
</field>
<field name = "testtest"
type = "text"
class = "input box
size = "40"
label = "Test"
description = "Test"
showon = "title:dr"
filter = "safehtml"/>
Render fields in layout-file of the view:
$this->userform->renderFieldset('contact');
Field testtest
is only visible if value dr
is chosen on dropdown-field title
.
Field testtest
is always visible.
Category | ⇒ | Fields |
Labels |
Added:
?
|
Works fine on my system too !
Closing as not able to reproduce.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-04-02 19:33:37 |
Closed_By | ⇒ | Bakual |
Just tested with my own component and it works fine in frontend.
Make sure you use JForm to render the field and also try with Protostar to rule out a template issue.
Also check the browser console for JavaScript errors.