/**
 * Like 'observe_field()', but operates on an entire form identified by the
 * DOM ID '$form_id'. '$options' are the same as 'observe_field()', except
 * the default value of the 'with' option evaluates to the
 * serialized (request string) value of the form.
 */
function observe_form($form_id, $options = array())
{
    sfContext::getInstance()->getResponse()->addJavascript(sfConfig::get('sf_prototype_web_dir') . '/js/prototype');
    if (isset($options['frequency']) && $options['frequency'] > 0) {
        return _build_observer('Form.Observer', $form_id, $options);
    } else {
        return _build_observer('Form.EventObserver', $form_id, $options);
    }
}
Example #2
0
function observe_form($form_id, $options = array())
{
    $obj =& get_instance();
    $obj->response->enqueue_js('prototype');
    if (isset($options['frequency']) && $options['frequency'] > 0) {
        return _build_observer('Form.Observer', $form_id, $options);
    } else {
        return _build_observer('Form.EventObserver', $form_id, $options);
    }
}