Place for some configs

Li Europan lingues es membres del sam familie. Lor separat existentie es un myth. Por scientie, musica, sport etc, litot Europa usa li sam vocabular. Li lingues differe solmen in li grammatica, li pronunciation e li plu commun vocabules. Omnicos directe al desirabilite de un nov lingua franca: On refusa continuar payar custosi traductores.

Form v 1.3.5

A Form which handles (almost) everything for you. Check out a full featured example here

Options read more about inline data attributes

optiondefaultpossible valuesdescriptionsinceinfo
submitbutton'button.submit'[jQuery Selector] A jQuery selector which gets the submit action. Can be a jQuery object (>=1.2)1.0
resetbutton'button.reset'[jQuery Selector] A jQuery selector which gets the submit action. Can be a jQuery object (>=1.2)1.0
method'post''post' | 'get' The method which will be used for sending the form1.0Will get overwritten by the form's method attribute
actionnullstring The reciver address on the server (e.q. submit.php).1.0Will get overwritten by the form's action attribute
ajaxtruetrue | false send the form with an ajax request. requires for callback function. If set to false it uses native form submit1.1
serializefalsetrue | false If set to false an object is sent to the server. If set to true it will send a serialised version of the data (key=value&key2=value2)1.0
statustruetrue | false Set a status message after the submit button1.0
sentfalsetrue | false is true after the form is sent1.0
confirmSendtruetrue | false a confirmation box appear if set to true and option 'sent' is true1.0
text[texts]object an object with all required texts1.0
parseQuerytruetrue | false parse the query string from the location and fill the form with the data1.0Fill the example form with something or check out the full featured example here
onRequireErrorfunction(){}function(element) callback if an required field isn't set. element is the respective jQuery element (input, textarea,...)1.0
onValidErrorfunction(){}function(element) callback if an valid field isn't valid. element is the respective jQuery element (input, textarea,...)1.0
onPasswordErrorfunction(){}function(element) callback if an error occured on a password field. element is the respective jQuery element1.0
onFileErrorfunction(){}function(element) callback if an error occured on a file upload field. element is the respective jQuery element1.1
onBeforePreparefunction(data){}function(data) function before the form will collect and prepare the data from the inputs. Form will not be sent if this returns false1.2
onBeforeSubmitfunction(data){}function(data) function to handle the data before the form will get send. Form will not be sent if this returns false. Can return a new data object which will be used for sending (>=1.2)1.0
onResetfunction(){}function() callback if form get resetted. can return false to prevent reset1.2
onCompletefunction(){}function(textStatus, jqXHR) callback if the form was sent. regeardless if successful or not1.0
onErrorfunction(){}function(textStatus, error, jqXHR) callback if the form was sent and an error occures.1.0
onSuccessfunction(){}function(data, textStatus, jqXHR) callback if the form was sent succesful. data holds the response from the server1.0

Methods

method namedefaultargumentsdescriptionsinceinfo
disable disables the Form1.0
enable enables the Form1.0
reset resets the form1.2
submit submits the form1.0
unserializequerystring unserialze the querystring and fills the form. Uses location.search if no querystring is set1.0
setkey, value sets the the option 'key' with the value 'value'1.0

Usage

$(selector).wl_Form([options]);

Calling Methods

$(selector).wl_Form('method', [,arg [,arg]]);

Markup

<form action="submit.php" method="post">
	<fieldset>
		<label>Fieldset Label</label>
		<section><label for="input">Label</label>
			<div><input type="text" id="input" name="input" required></div>
		</section>
		...
		<section>
			<div><button>Submit</button></div>
		</section>
	</fieldset>
</form>

Example

use autocomplete="off" on a form to prevent old data within input fields!

Native Submit

<form action="submit.php" method="post" data-ajax="false">
	<fieldset>
		<label>Native Submitting Form</label>
		<section><label for="input">Label</label>
			<div><input type="text" id="input" name="input" required></div>
		</section>
	</fieldset>
</form>

or set the option within the call (instead of data-ajax="false"):

$('form').wl_Form({
	ajax:false
});
You can test the example form with native submit by clicking the button above it!