Form Plugin API
http://www.malsup.com/jquery/form/#api
Form Plugin API
The Form Plugin API provides several methods that allow you to easily manage form data and form submission.
ajaxForm
Prepares a form to be submitted via AJAX by adding all of the necessary event listeners. It does not submit the form. Use ajaxForm
in your document's ready
function to prepare your form(s) for AJAX submission. ajaxForm
takes zero or one argument. The single argument can be either a callback function or an Options Object.
Chainable: Yes.
Note: You can pass any of the standard $.ajax
options to ajaxForm
Example:
$('#myFormId').ajaxForm();
ajaxSubmit
Immediately submits the form via AJAX. In the most common use case this is invoked in response to the user clicking a submit button on the form. ajaxSubmit
takes zero or one argument. The single argument can be either a callback function or an Options Object.
Chainable: Yes.
Note: You can pass any of the standard $.ajax
options to ajaxSubmit
Example:
// attach handler to form's submit event
$('#myFormId').submit(function() {
// submit the form
$(this).ajaxSubmit();
// return false to prevent normal browser submit and page navigation
return false;
});
formSerialize
Serializes the form into a query string. This method will return a string in the format: name1=value1&name2=value2
Chainable: No, this method returns a String.
Example:
var queryString = $('#myFormId').formSerialize();
// the data could now be submitted using $.get, $.post, $.ajax, etc
$.post('myscript.php', queryString);
fieldSerialize
Serializes field elements into a query string. This is handy when you need to serialize only part of a form. This method will return a string in the format: name1=value1&name2=value2
Chainable: No, this method returns a String.
Example:
var queryString = $('#myFormId .specialFields').fieldSerialize();
fieldValue
Returns the value(s) of the element(s) in the matched set in an array. As of version .91, this method always returns an array. If no valid value can be determined the array will be empty, otherwise it will contain one or more values.
Chainable: No, this method returns an array.
Example:
// get the value of the password input
var value = $('#myFormId :password').fieldValue();
alert('The password is: ' + value[0]);
resetForm
Resets the form to its original state by invoking the form element's native DOM method.
Chainable: Yes.
Example:
$('#myFormId').resetForm();
clearForm
Clears the form elements. This method emptys all of the text inputs, password inputs and textarea elements, clears the selection in any select elements, and unchecks all radio and checkbox inputs.
Chainable: Yes.
$('#myFormId').clearForm();
clearFields
Clears field elements. This is handy when you need to clear only a part of the form.
Chainable: Yes.
$('#myFormId .specialFields').clearFields();
分享到:
相关推荐
Form Plugin API 里提供了很多有用的方法可以让你轻松的处理表单里的数据和表单的提交过程。 测试环境:部署到Tomcat中的web项目。 本文演示的是:jQuery form插件之ajaxForm()和ajaxSubmit()的可选参数项对象 ajax...
Form Plugin API 里提供了很多有用的方法可以让你轻松的处理表单里的数据和表单的提交过程,通过本文给大家介绍jQuery form插件之formDdata参数校验表单及验证后提交的相关知识,感兴趣的朋友一起学习吧
Appendix B: WordPress API Reference 263 PHP functions 263 dirname 263 file_get_contents 263 preg_match 264 preg_replace 264 print_r 264 sprintf 265 strtolower 265 substr 265 WordPress ...
form:添加“onChange”事件; combobox:添加“queryParams”属性; slider:添加“range”属性; menu:添加“itemHeight”,“inline”,“noline”和“align”属性; panel:添加“header”属性,允许用户...
tree:添加“getRoot”方法 用于返回通过“nodeEl”参数指定的节点的顶部父节点元素 注意:官网的英文API中该函数的说明有误 其说明是none 无参数 实际这里是需要参数的 ; tree:添加“queryParams”属性; ...
form:添加“ajax” “novalidate”和“queryParams”属性; linkbutton:添加“resize”方法 New Plugin(新组件) textbox:该组件是一个增强的输入字段 它可以让用户非常简单的构建一个表单; ...
•The plugin API. •List of all available Options - including events and callback methods. •Explanation of all Plugin files. •Extended Browser support information. •Frequently Asked Questions (FAQ)...
jquery 休息表单插件关于它是一个包装插件,使 jQuery Form Plugin 对应于 RESTful URL。jQuery 表单插件必需的jQuery(推荐更高版本) jQuery 表单插件用法如果在 url 中输入 [: (param_name)] ,它将被替换为相应...
TYPO3扩展“ me_cleverreach” ...plugin.tx_mecleverreach.settings.config.formId =表单ID plugin.tx_mecleverreach.settings.config.listId =列表ID 如何使用 配置CleverReach api数据并将插件添加
虽然已经解释多遍,但是依然有人不知道,索性就取消chm格式的文档了,今后统一采用exe+pdf格式,由于目前尚无时间制作pdf格式的api文档,所以1.5版中只有exe的,pdf格式将在下一版中提供。 jQuery EasyUI 1.5版本...
Fastify插件公开Mongoose MongoDB模型的API 如果您将用作服务器,而将用作ODM,则fastify-mongoose-api是... /// need form body to accept API parametersfastify . register ( fastifyMongooseAPI , { /// here we a
我建议您尝试一下jaxb-expression-plugin。 jaxb格式插件 用于JAXB(用于XML绑定的Java API)架构到源代码的编译器(XJC)的插件,该代码生成代码以通过任意帮助程序类格式化生成的类的实例。 动机 XJC当前有多个...
下面记录一下使用中学习到的相关API,不定期更新。 1. 获取validator对象或实例 一般使用校验是直接调用$(form).bootstrapValidator(options)来初始化validator。初始化后有两种方式获取validator对象或实例,...
Custom Subdomains for each User- Embeddable Forms- Forms as a Service API在v1.0.0的路线图上- Implement encryption for all form data- Add Typeform API integration- Add plugin/3rd party integration ...
最近比较忙,抽空做了最新版的API,本次的主要精力就是放在了pdf版的文档上面,看了上一版好多人反应说希望保留chm格式的,所以这一版继续提供chm格式的文档给大家了,现在的版本中包含了PDF、EXE和CHM 3种格式的...
JSPrismarine的简单表单api! 如何使用它! 首先导入您要使用的所有表单和FormResponceEvent。 import { ModalForm , FormResponceEvent } from "jspformapi" ; 接下来创建一个表单并向其中添加信息! const ...
form:修复“clear”方法无法清除combobox组件选择的下拉项的问题。 Improvement(改进) textbox:可以用“cls”属性添加自定义样式; numberbox:允许用户使用意大利货币格式; combo:添加“multivalue”属性,...