$.fn.ajaxForm = function(options) {
ajaxForm() provides a mechanism for fully automating form submission. The advantages of using this method instead of ajaxSubmit() are: 1: This method will include coordinates for <input type="image" /> elements (if the element is used to submit the form). 2. This method will include the submit element's name/value data (for the element that was used to submit the form). 3. This method binds the submit() method to the form for you. The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely passes the options argument along after properly binding events for submit elements and the form itself.
$.fn.formToArray = function(semantic) {
formToArray() gathers form element data into an array of objects that can be passed to any of the following ajax functions: $.get, $.post, or load. Each object in the array has both a 'name' and 'value' property. An example of an array for a simple login form might be: [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ] It is this array that is passed to pre-submit callback functions provided to the ajaxSubmit() and ajaxForm() methods.
$.fn.formSerialize = function(semantic) {
Serializes form data into a 'submittable' string. This method will return a string in the format: name1=value1&name2=value2
$.fn.fieldSerialize = function(successful) {
Serializes all field elements in the jQuery object into a query string. This method will return a string in the format: name1=value1&name2=value2
$.fn.fieldValue = function(successful) {
Returns the value(s) of the element in the matched set. For example, consider the following form: <form><fieldset> <input name="A" type="text" /> <input name="A" type="text" /> <input name="B" type="checkbox" value="B1" /> <input name="B" type="checkbox" value="B2"/> <input name="C" type="radio" value="C1" /> <input name="C" type="radio" value="C2" /> </fieldset></form> var v = $(':text').fieldValue(); // if no values are entered into the text inputs v == ['',''] // if values entered into the text inputs are 'foo' and 'bar' v == ['foo','bar'] var v = $(':checkbox').fieldValue(); // if neither checkbox is checked v === undefined // if both checkboxes are checked v == ['B1', 'B2'] var v = $(':radio').fieldValue(); // if neither radio is checked v === undefined // if first radio is checked v == ['C1'] The successful argument controls whether or not the field element must be 'successful' (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls). The default value of the successful argument is true. If this value is false the value(s) for each element is returned. Note: 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.
$.fieldValue = function(el, successful) {
Returns the value of the field element.
$.fn.clearForm = function(includeHidden) {
Clears the form data. Takes the following actions on the form's input fields: - input text fields will have their 'value' property set to the empty string - select elements will have their 'selectedIndex' property set to -1 - checkbox and radio inputs will have their 'checked' property set to false - inputs of type submit, button, reset, and hidden will *not* be effected - button elements will *not* be effected
$.fn.clearFields = $.fn.clearInputs = function(includeHidden) {
Clears the selected form elements.
$.fn.resetForm = function() {
Resets the form data. Causes all form elements to be reset to their original value.
$.fn.enable = function(b) {
Enables or disables any matching elements.
$.fn.selected = function(select) {
Checks/unchecks any matching checkboxes or radio buttons and selects/deselects and matching option elements.