Creates a button that submits the surrounding form as a remote ajax call serializing the fields into parameters.
Example controller for an application called "shop":
class BookController { def list = { [ books: Book.list( params ) ] } def show = { [ book : Book.get( params['id'] ) ] } }
Example usages for above controller:
<g:form action="show"> Login: <input name="login" type="text"></input> <g:submitToRemote update="updateMe" /> </g:form> <div id="updateMe">this div is updated by the form</div>
Attributes
url
- The url to submit to, either a map contraining keys for the action,controller and id or string valueupdate
(optional) - Either a map containing the elements to update for 'success' or 'failure' states, or a string with the element to update in which cause failure events would be ignoredbefore
(optional) - The javascript function to call before the remote function callafter
(optional) - The javascript function to call after the remote function callasynchronous
(optional) - Whether to do the call asynchronously or not (defaults to true)method
(optional) - The method to use the execute the call (defaults to "post")Events
onSuccess
(optional) - The javascript function to call if successfulonFailure
(optional) - The javascript function to call if the call failedon_ERROR_CODE
(optional) - The javascript function to call to handle specified error codes (eg on404="alert('not found!')")onUninitialized
(optional) - The javascript function to call the a ajax engine failed to initialiseonLoading
(optional) - The javascript function to call when the remote function is loading the responseonLoaded
(optional) - The javascript function to call when the remote function is completed loading the responseonComplete
(optional) - The javascript function to call when the remote function is complete, including any updates