public function __construct(&$form) { $this->form = $form; // do the jQuery script rendering only once if (self::$script_already_added == false) { Event::add('system.display', array($this, 'add_jquery')); self::$script_already_added = true; } // add possibility to remove ajax functionality $this->form->add_function('no_ajax', array($this, 'no_ajax')); Event::add('formoel.add', array($this, 'mark_required')); if (request::is_ajax()) { Event::add('formoel.post_validate', array($this, 'ajax_validation')); } }
public function __construct(&$form) { $this->form = $form; // add form to ajaxed forms list $this->ajaxed_forms[] = $this->form->_formo_name; // do the jQuery script rendering only once if (self::$script_already_added == false) { Event::add('system.display', array($this, 'add_jquery')); self::$script_already_added = true; } // add possibility to remove ajax functionality $this->form->add_function('no_ajax', array($this, 'no_ajax')); // add 'ajaxval' and possible 'required' class to elements Event::add('formoel.pre_render', array($this, 'mark_ajaxed_and_required')); if (request::is_ajax() and isset($_GET['element']) and in_array($this->form->_formo_name, $this->ajaxed_forms)) { Event::add('formogroup.pre_validate', array($this, 'ajax_group_validation')); Event::add('formoel.post_validate', array($this, 'ajax_validation')); } }