public function validate($value) { if (@$_POST[$this->name . '_id']) { $this->validator['captcha']['id'] = $_POST[$this->name . '_id']; } return parent::validate($value); }
public function render() { $url = $this->view->url(array('controller' => 'x', 'action' => 'suggest')); $opt = array_merge(array('typeahead' => array('source' => new Zend\Json\Expr('adapter.ttAdapter()'))), $this->opt->to_array()); $this->view->messify->append('js', '/' . DIR_KERNEL . '/js/jquery/typeahead.bundle.js')->append('js', '/' . DIR_KERNEL . '/ctl/bootstrap/tokenfield/bootstrap-tokenfield.js')->append_inline('js', 'var adapter = new Bloodhound(' . Zend\Json\Json::encode(array('datumTokenizer' => new Zend\Json\Expr('Bloodhound.tokenizers.obj.whitespace("value")'), 'queryTokenizer' => new Zend\Json\Expr('Bloodhound.tokenizers.whitespace'), 'prefetch' => array('url' => $url, 'ajax' => array('type' => 'post', 'data' => array('term' => 1, 'model' => $this->model, 'method' => $this->method)))), false, array('enableJsonExprFinder' => true)) . ');adapter.initialize();var o = $("input[name=\'' . $this->name . '\']");o.tokenfield(' . Zend\Json\Json::encode($opt, false, array('enableJsonExprFinder' => true)) . ');')->append('css', '/' . DIR_KERNEL . '/ctl/bootstrap/tokenfield/bootstrap-tokenfield.css')->append('css', '/' . DIR_KERNEL . '/ctl/bootstrap/tokenfield/tokenfield-typeahead.css'); return parent::render(); }
public function render() { $url = $this->view->url(array('controller' => 'x', 'action' => 'suggest')); $opt = array_merge(array('width' => '100%', 'height' => '49px', 'unique' => new Zend\Json\Expr(true), 'autocomplete_url' => $url, 'autocomplete' => array('source' => new Zend\Json\Expr('function(request, response) { request["model"] = "' . $this->model . '"; request["method"] = "' . $this->method . '"; $.ajax({ url: "' . $url . '", type: "post", dataType: "json", data: request, success: function(data) { if (data.length == 0) o.val(""); response(data); } }); }'))), $this->ui->opt->to_array()); $this->view->messify->append('js', '/' . DIR_KERNEL . '/ctl/ui/ui/jquery.ui.core.js')->append('js', '/' . DIR_KERNEL . '/ctl/ui/ui/jquery.ui.widget.js')->append('js', '/' . DIR_KERNEL . '/ctl/ui/ui/jquery.ui.position.js')->append('js', '/' . DIR_KERNEL . '/ctl/ui/ui/jquery.ui.menu.js')->append('js', '/' . DIR_KERNEL . '/ctl/ui/ui/jquery.ui.autocomplete.js')->append('js', '/' . DIR_KERNEL . '/ctl/tagsinput/jquery.tagsinput.js')->append_inline('js', 'var o = $("input[name=\'' . $this->name . '\']");o.tagsInput(' . Zend\Json\Json::encode($opt, false, array('enableJsonExprFinder' => true)) . ');')->append('css', '/' . DIR_KERNEL . '/ctl/ui/themes/' . $this->ui->theme . '/jquery.ui.core.css')->append('css', '/' . DIR_KERNEL . '/ctl/ui/themes/' . $this->ui->theme . '/jquery.ui.theme.css')->append('css', '/' . DIR_KERNEL . '/ctl/ui/themes/' . $this->ui->theme . '/jquery.ui.menu.css')->append('css', '/' . DIR_KERNEL . '/ctl/ui/themes/' . $this->ui->theme . '/jquery.ui.autocomplete.css')->append('css', '/' . DIR_KERNEL . '/ctl/tagsinput/jquery.tagsinput.css'); return parent::render(); }