Japanese Tag - submitToRemote

Last updated by admin 3 years ago

?? - submitToRemote

?? Description

Creates a button that submits the surrounding form as a remote ajax call serializing the fields into parameters. ?????????????????????????????AJAX??????????????????

????? Parameters

  • url - ?????????URL????action,controller,id,????????MAP?The url to submit to, either a map contraining keys for the action,controller and id or string value
  • action (??) - ?????????????????????????????????????????The action to execute as a fallback, defaults to the url if non specified
  • update (??) - 'success' ??'failure'????????????Map???????????failure????????? 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 ignored
  • before (??) - ????????????????????????javascript????????The javascript function to call before the remote function call
  • after (??) - ?????????????????????????javascript????????The javascript function to call after the remote function call
  • asynchronous (??) - ????????????????(??????true)?Whether to do the call asynchronously or not (defaults to true)
  • method (??) - ??????????????(?????? "post") The method to use the execute the call (defaults to "post")

???? Events

  • onSuccess (??) - ?????????????javascript????????The javascript function to call if successful
  • onFailure (??) - ????????????????javascript????????The javascript function to call if the call failed
  • on_ERROR_CODE (??) - ???????????????????????javascript???????(? on404="alert('not found!')")?The javascript function to call to handle specified error codes (eg on404="alert('not found!')")
  • onUninitialized (??) - Ajax??????????????????????????javascript????????The javascript function to call the a ajax engine failed to initialise
  • onLoading (??) - ?????????????????javascript????????The javascript function to call when the remote function is loading the response
  • onLoaded (??) - ?????????????????????javascript????????The javascript function to call when the remote function is completed loading the response
  • onComplete (??) - ???????????????????????javascript??????????????????????The javascript function to call when the remote function is complete, including any updates

? Examples

Example controller for an application called "shop": "shop"??????????????????????????

class Book {
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>