/** * This is a helper method to compute all JS that is needed to get a form element * * @param $formElement Form element object */ function __getJSFormElement($formElement, $options) { $js = ''; // check if this element is a wysiwyg editor if (in_array($formElement->getAttribute('id'), $this->wysiwyg_ids)) { // include editor lib require_once dirname(__FILE__) . '/editors/YDAjaxEditor.php'; // wysiwyg editor require to copy their html to a textarea before submit $js .= YDAjaxEditor::JScopy($formElement->getAttribute('id')); } // add JS return value $js .= $formElement->getJS($options); // compute javascript function name $jsfunction = $this->prefix . 'get' . $formElement->getName(); // add javascript function code to custom js (to be included in template head) if (!$this->onResponse) { $this->customjs[$jsfunction . '()'] = $js; } else { $this->response->addScript($jsfunction . '=function(){' . $js . '}'); } // add function name to arguments list return $jsfunction . '()'; }