7

I develop my own template for Joomla and i need to display more options if you set a value before.

For example:

enter image description here

after clicking on YES:

enter image description here

It would be nice if in the joomla core a solution like this:

<field name="field1" type="radio" class="btn-group" default="0" label="Deactivate Joomla JavaScript" >
<option value="0">No</option>
<option value="1">Yes</option>
</field>
<field name="field2" type="checkboxes" class="btn-group" default="0" label="Deactivate Joomla JavaScript" showif="field1::1">
<option value="0">Everything</option>
<option value="1">mootools-core.js</option>
<option value="2">mootools-more.js</option>
</field>

A new showif parameter with the value field1::1 . field1 is the previous field and number 1 is for value from the needed option to display this form field.

2
  • You will need to create a custom form field for this. There was an accordion module that had this feature in. If you selected K2 integration, another form field appeared allowing you to select the K2 category. I will try and find which module it was so you can see how they did it
    – Lodder
    May 23, 2014 at 17:29
  • 1

2 Answers 2

9

The feature which you require was introduced in Joomla 3.3.x. You now have the ability to use showon="show_label:1"

You can se the PR, which introduced the functionality here: https://github.com/joomla/joomla-cms/pull/3127

1
  • This is awesome, no more need for a JS solution or a custom button
    – Eoin
    Jun 18, 2017 at 8:47
0

Is it on the admin side or on the front end? Like for examaple you wanna insert one extra filed after selecting the menu item type on the admin site, this is what you need tot do: Edit the default.xml in :/components/com_yourcomponent/views/folios/tmpl/

<?xml version="1.0" encoding="utf-8"?>
 <metadata>
 <layout title="com_folio_folios_view_default_title" option="com_
 folio_folios_view_default_option">
  <message>
  <![CDATA[com_folio_folios_view_default_desc]]>
  </message>
 </layout>
 <fields name="request">
  <fieldset name="request">
   <field
    name="catid"
     type="category"
     extension="com_folio"
     class="inputbox"
     default=""
     label="COM_FOLIO_FIELD_CATID_LABEL"
     description="COM_FOLIO_FIELD_CATID_DESC"
     required="true"
    >
   <option value="0">JOPTION_SELECT_CATEGORY</option>
  </field>
  </fieldset>
 </fields>
</metadata>"

This one will insert a category selector after selecting your component from the popup window of your menu type.

1
  • This question is for the template Parameters. Jun 5, 2014 at 10:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.