mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
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:
parent
4347f25025
commit
de0c4e8500
1 changed files with 7 additions and 2 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue