diff --git a/lam/lib/html.inc b/lam/lib/html.inc index 9f547c0b..a1866ffc 100644 --- a/lam/lib/html.inc +++ b/lam/lib/html.inc @@ -1286,6 +1286,8 @@ class htmlRadio extends htmlElement { private $selectedElement = null; /** enabled or disabled */ private $isEnabled = true; + /** on change code */ + private $onchangeEvent = null; /** * Constructor. @@ -1326,16 +1328,27 @@ class htmlRadio extends htmlElement { if (!$this->isEnabled) { $disabled = ' disabled'; } + $onchange = ''; + if ($this->onchangeEvent != null) { + $onchange = ' onchange="' . $this->onchangeEvent . '"'; + } // print radio list $counter = 0; foreach ($this->elements as $label => $value) { - $onClick = 'onClick="jQuery(\'input[name=' . $this->name . ']\').attr(\'checked\', false);jQuery(\'#' . $this->name . $counter . '\').attr(\'checked\', true);"'; + $onClick = 'onClick=" + jQuery(\'input[name=' . $this->name . ']\').attr(\'checked\', false); + jQuery(\'#' . $this->name . $counter . '\').attr(\'checked\', true); + jQuery(\'#' . $this->name . $counter . '\').trigger(\'change\'); + "'; + if ($this->isEnabled === false) { + $onClick = ''; + } echo '