diff --git a/administrator/components/com_config/view/component/tmpl/default.php b/administrator/components/com_config/view/component/tmpl/default.php
index b8b57e777d0a8..fc9bf5b8b04d1 100644
--- a/administrator/components/com_config/view/component/tmpl/default.php
+++ b/administrator/components/com_config/view/component/tmpl/default.php
@@ -60,7 +60,7 @@
showon)) : ?>
'auto', 'relative' => true)); ?>
- formControl, $fieldSet->showon)) . '\''; ?>
+ showon, $this->formControl)) . '\''; ?>
label) ? 'COM_CONFIG_' . $name . '_FIELDSET_LABEL' : $fieldSet->label; ?>
>
diff --git a/layouts/joomla/searchtools/default/filters.php b/layouts/joomla/searchtools/default/filters.php
index 86b2992f235a0..31c0f6959c345 100644
--- a/layouts/joomla/searchtools/default/filters.php
+++ b/layouts/joomla/searchtools/default/filters.php
@@ -24,7 +24,7 @@
showon) : ?>
'auto', 'relative' => true)); ?>
- formControl, $field->showon)) . "'"; ?>
+ showon, $field->formControl, $field->group)) . "'"; ?>
>
input; ?>
diff --git a/libraries/joomla/form/field.php b/libraries/joomla/form/field.php
index 19342d63d3d96..de4b500bf4c36 100644
--- a/libraries/joomla/form/field.php
+++ b/libraries/joomla/form/field.php
@@ -952,7 +952,8 @@ public function renderField($options = array())
if ($this->showon)
{
- $options['rel'] = ' data-showon=\'' . json_encode(JFormHelper::parseShowOnConditions($this->formControl, $this->showon)) . '\'';
+ $options['rel'] = ' data-showon=\'' .
+ json_encode(JFormHelper::parseShowOnConditions($this->showon, $this->formControl, $this->group)) . '\'';
$options['showonEnabled'] = true;
}
diff --git a/libraries/joomla/form/helper.php b/libraries/joomla/form/helper.php
index acc6f89660ac9..633b00ec22e8b 100644
--- a/libraries/joomla/form/helper.php
+++ b/libraries/joomla/form/helper.php
@@ -320,14 +320,15 @@ protected static function addPath($entity, $new = null)
/**
* Parse the show on conditions
*
- * @param string $formControl Form name.
* @param string $showOn Show on conditions.
+ * @param string $formControl Form name.
+ * @param string $group The dot-separated form group path.
*
* @return array Array with show on conditions.
*
* @since __DEPLOY_VERSION__
*/
- public static function parseShowOnConditions($formControl, $showOn)
+ public static function parseShowOnConditions($showOn, $formControl = null, $group = null)
{
// Process the showon data.
if (!$showOn)
@@ -338,13 +339,20 @@ public static function parseShowOnConditions($formControl, $showOn)
$showOnData = array();
$showOnParts = preg_split('#\[AND\]|\[OR\]#', $showOn);
+ $formPath = $formControl ?: '';
+
+ if ($formPath && $group)
+ {
+ $formPath .= '[' . $group . ']';
+ }
+
foreach ($showOnParts as $showOnPart)
{
$compareEqual = strpos($showOnPart, '!:') === false;
$showOnPartBlocks = explode(($compareEqual ? ':' : '!:'), $showOnPart, 2);
$showOnData[] = array(
- 'field' => $formControl ? $formControl . '[' . $showOnPartBlocks[0] . ']' : $showOnPartBlocks[0],
+ 'field' => $formPath ? $formPath . '[' . $showOnPartBlocks[0] . ']' : $showOnPartBlocks[0],
'values' => explode(',', $showOnPartBlocks[1]),
'sign' => $compareEqual === true ? '=' : '!=',
'op' => preg_match('#^\[(AND|OR)\]#', $showOnPart, $matches) ? $matches[1] : '',