jQuery EasyUI Form

来源:互联网 发布:出纳用什么软件 编辑:程序博客网 时间:2024/05/22 11:34

Form

Usage

  1. <form id="ff" method="post">  
  2.     ...  
  3. </form>  

To make the form become ajax submit form

  1. $('#ff').form({  
  2.     url:...,  
  3.     onSubmit: function(){  
  4.         // do some check  
  5.         // return false to prevent submit;  
  6.     },  
  7.     success:function(data){  
  8.         alert(data)  
  9.     }  
  10. });  
  11. // submit the form  
  12. $('#ff').submit();  

To do a submit action

  1. // call 'submit' method of form plugin to submit the form  
  2. $('#ff').form('submit', {  
  3.     url:...,  
  4.     onSubmit: function(){  
  5.         // do some check  
  6.         // return false to prevent submit;  
  7.     },  
  8.     success:function(data){  
  9.         alert(data)  
  10.     }  
  11. });  

Properties

NameTypeDescriptionDefaulturlstringThe form action URL to submitnull

Events

NameParametersDescriptiononSubmitnoneFires before submit, return false to prevent submit action.successdataFires when the form is submitted successfuly.onBeforeLoadparamFires before a request is made to load data. Return false to cancel this action.onLoadSuccessdataFires when the form data is loaded.onLoadErrornoneFires when some errors occur while loading form data.

Methods

NameParameterDescriptionsubmitoptionsDo the submit action, the options parameter is a object which contains following properties:
url: the action URL
onSubmit: callback function before submit
success: callback function after submit successfulyloaddataLoad records to fill the form.
The data parameter can be a string or a object type, when string acts as a remote URL, otherwise acts as a local recordclearnoneClear the form datavalidatenoneDo the form fields validation, return true when all fields is valid. The method is used with the validatebox plugin.
原创粉丝点击