Makes the element with the DOM ID specified by '$element_id' receive
dropped draggable elements (created by 'draggable_element()') and make an AJAX call.
By default, the action called gets the DOM ID of the element as parameter.
Example:
'url' => 'cart/add',
)) ?>
You can change the behaviour with various options, see
http://script.aculo.us for more documentation.
Returns a form tag that will submit using XMLHttpRequest in the background instead of the regular
reloading POST arrangement. Even though it's using JavaScript to serialize the form elements, the form submission
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()'.
A "fall-through" target for browsers that don't do JavaScript can be specified
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
either 'render_partial()'.
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
which various JavaScript callbacks can be triggered (for progress indicators and
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
finished loading.
'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
range.
'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
in JavaScript code snippets via some optional parameters. In
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.
'with' A JavaScript expression specifying the
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
link_to_remote().
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.
Periodically calls the specified url ('url') every 'frequency' seconds (default is 10).
Usually used to update a specified div ('update') with the results of the remote call.
The options for specifying the target with 'url' and defining callbacks is the same as 'link_to_remote()'.
Makes the elements with the DOM ID specified by '$element_id' sortable
by drag-and-drop and make an AJAX call whenever the sort order has
changed. By default, the action called gets the serialized sortable
element as parameters.
Example:
'url' => '@order',
)) ?>
In the example, the action gets a '$my_list' array parameter
containing the values of the ids of elements the sortable consists
of, in the current order.
You can change the behaviour with various options, see
http://script.aculo.us for more documentation.
Returns a Javascript function (or expression) that will update a DOM element '$element_id'
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'.
If no '$element_id' is given, it assumes "element" which should be a local
variable in the generated JavaScript execution context. This can be used
for example with drop_receiving_element():
...
'loading' => visual_effect('fade'),
)) ?>
This would fade the element that was dropped on the drop receiving element.
You can change the behaviour with various options, see
http://script.aculo.us for more documentation.