Implementing Form.Element.EventObserver in AjaxHelper::observeField (Ticket #1194)

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@3294 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
nate 2006-07-23 16:10:35 +00:00
parent 4347f25025
commit de0c4e8500

View file

@ -398,7 +398,12 @@ class AjaxHelper extends Helper {
if (!isset($options['with'])) { if (!isset($options['with'])) {
$options['with'] = "Form.Element.serialize('$field_id')"; $options['with'] = "Form.Element.serialize('$field_id')";
} }
return $this->Javascript->codeBlock($this->_buildObserver('Form.Element.Observer', $field_id, $options)); if (!isset($options['frequency']) || intval($options['frequency']) == 0) {
$observer = 'Event';
} else {
$observer = '';
}
return $this->Javascript->codeBlock($this->_buildObserver('Form.Element.' . $observer . 'Observer', $field_id, $options));
} }
/** /**
@ -754,7 +759,7 @@ class AjaxHelper extends Helper {
$callback = $this->remoteFunction($options); $callback = $this->remoteFunction($options);
$javascript = "new $klass('$name', "; $javascript = "new $klass('$name', ";
$javascript .= (isset($options['frequency']) ? $options['frequency'] : 2) . ", function(element, value) {"; $javascript .= (isset($options['frequency']) ? $options['frequency'] . ', ' : '') . "function(element, value) {";
$javascript .= "$callback})"; $javascript .= "$callback})";
return $javascript; return $javascript;
} }