Grails - Japanese Tag - formRemote

?? - formRemote

?? Description

Creates a form tag that uses a remote uri to execute an ajax call serializing the form elements falling back to a normal form submit if javascript is not supported. javascript???????????????????????????????????????????uri?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 defaultAction="list"
def list = { [ books: Book.list( params ) ] }
def show = { [ book : Book.get( params['id'] ) ] }
}
Example usages for above controller: ??????????????
<g:formRemote name="myForm" on404="alert('not found!')" update="updateMe" action="show">
Login: <input name="login" type="text"></input>
</g:formRemote>
<div id="updateMe">this div is updated by the form</div>