added hidden field for selected accordion tab

This commit is contained in:
Roland Gruber 2018-10-21 10:08:17 +02:00
parent ea40d3b796
commit a804f94d6f
1 changed files with 7 additions and 1 deletions

View File

@ -3816,10 +3816,16 @@ class htmlAccordion extends htmlElement {
echo '</div>';
}
echo '</div>';
$hiddenIndexId = $this->id . "_index";
echo '<input type="hidden" name="' . $hiddenIndexId . '" id="' . $hiddenIndexId . '" value="' . $active . '">';
$script = 'jQuery(function() {
$( "#' . $this->id . '" ).accordion({
collapsible: ' . $collapsible . ',
active: ' . $active . '
active: ' . $active . ',
activate: function( event, ui ) {
var newOption = jQuery("#' . $this->id . '").accordion( "option", "active" );
jQuery("#' . $this->id . '_index").val(newOption);
}
});
});';
$js = new htmlJavaScript($script);