public function __construct($options = null) { $options['class'] = 'form-horizontal'; parent::__construct($options); /** * Make it a JQuery form * * NOTE: Do this for all subforms you add afterwards */ $this->activateJQuery(); /** * You must set the form id so that you can add your tabPanes to the tabContainer */ if (is_null($this->getAttrib('id'))) { $this->setAttrib('id', 'mainForm'); } /** * Now we add a hidden element to hold the selected tab */ $this->addElement(new \Zend_Form_Element_Hidden('tab')); $jquery = $this->getView()->jQuery(); /** * This script handles saving the tab to our hidden input when a new tab is showed */ //if (\MUtil_Bootstrap::enabled()) { $js = sprintf(' var listItem = %1$s(".active"); var tabContainer = %1$s("#tabContainer"); var tabs = tabContainer.find("ul li"); var activeTab = tabs.index(listItem); %1$s("#tab").val(activeTab); tabContainer.on("click", "ul li", function(e) { var listItem = %1$s(this); var activeTab = tabs.index(listItem); %1$s("#%2$s #tab").val(activeTab); });', \ZendX_JQuery_View_Helper_JQuery::getJQueryHandler(), $this->getAttrib('id')); $jquery->addOnLoad($js); }