Returns a form tag that will submit using XMLHttpRequest in the background instead of the regular
will work just like a regular submission as viewed by the receiving side (all elements available in 'params').
The options for specifying the target with 'url' and defining callbacks are the same as 'link_to_remote()'.
with the 'action'/'method' options on '$options_html'
Returns a link to a remote action defined by 'url'
(using the 'url_for()' format) that's called in the background using
XMLHttpRequest. The result of that request can then be inserted into a
DOM object whose id can be specified with 'update'.
Usually, the result would be a partial prepared by the controller with
Optionally, you can use the 'position' parameter to influence
how the target DOM element is updated. It must be one of
'before', 'top', 'bottom', or 'after'.
By default, these remote requests are processed asynchronous during
the likes). All callbacks get access to the 'request' object,
which holds the underlying XMLHttpRequest.
To access the server response, use 'request.responseText', to
find out the HTTP status, use 'request.status'.
The callbacks that may be specified are (in order):
'loading' Called when the remote document is being
loaded with data by the browser.
'loaded' Called when the browser has finished loading
the remote document.
'interactive' Called when the user can interact with the
remote document, even though it has not
'success' Called when the XMLHttpRequest is completed,
and the HTTP status code is in the 2XX range.
'failure' Called when the XMLHttpRequest is completed,
and the HTTP status code is not in the 2XX
'complete' Called when the XMLHttpRequest is complete
(fires after success/failure if they are present).,
You can further refine 'success' and 'failure' by adding additional
callbacks for specific status codes:
A status code callback overrides the success/failure handlers if present.
If you for some reason or another need synchronous processing (that'll
block the browser while the request is happening), you can specify
'type' => 'synchronous'.
You can customize further browser side call logic by passing
their order of use these are:
'confirm' Adds confirmation dialog.
'condition' Perform remote request conditionally
by this expression. Use this to
describe browser-side conditions when
request should not be initiated.
'before' Called before request is initiated.
'after' Called immediately after request was
initiated and before 'loading'.
'submit' Specifies the DOM element ID that's used
as the parent of the form elements. By
default this is the current form, but
it could just as well be the ID of a
table row or any other DOM element.
Observes the field with the DOM ID specified by '$field_id' and makes
an AJAX call when its contents have changed.
Required '$options' are:
'url' 'url_for()'-style options for the action to call
when the field has changed.
Additional options are:
'frequency' The frequency (in seconds) at which changes to
this field will be detected. Not setting this
option at all or to a value equal to or less than
zero will use event based observation instead of
time based observation.
'update' Specifies the DOM ID of the element whose
innerHTML should be updated with the
XMLHttpRequest response text.
parameters for the XMLHttpRequest. This defaults
to 'value', which in the evaluated context
refers to the new field value.
Additionally, you may specify any of the options documented in
according to the '$options' passed.
Possible '$options' are:
'content' The content to use for updating. Can be left out if using block, see example.
'action' Valid options are 'update' (assumed by default), 'empty', 'remove'
'position' If the 'action' is 'update', you can optionally specify one of the following positions:
'before', 'top', 'bottom', 'after'.