Form command
Create an ajax submitted form.
Basic Usage (HTML)
data-jkit="[form:error=Your error message;success=Your success message]"
Advanced Init (JavaScript)
$('#myelement').jKit('form', { 'error': 'Your error message', 'success': 'Your success message' });
Options
Option | Values | Default | Description |
---|---|---|---|
validateonly | “yes” or “no” | no | Only validate the form? Don’t handle the submission. |
error | HTML | The error message to show for the whole form if it doesn’t validate | |
success | HTML | The success message to show for the whole form after submit | |
macro | Macro name | This optional macro will be applied to the element after success |
Events
Event | Description |
---|---|
complete | Triggered after the form is sucessfully submited |
error | Triggered when an error occurs |
Examples
Register field validation:
In this simple example we’re validating two form field you would normally use in a user register form:
Source:
<form method="post" action="?" data-jkit="[form:validateonly=true]"> <p> <label for="miniusername">Username:</label><br /> <input name="miniusername" id="miniusername" data-jkit="[validate:required=true;min=3;max=10;error=Please enter your username (3-10 characters)]"> </p> <p> <label for="minipassword">Password:</label><br /> <input name="minipassword" id="minipassword" type="password" data-jkit="[validate:required=true;strength=50;error=Please enter a secure password]"> </p> <p> <input name="send" type="submit" value="Submit" /> </p> </form>
Replacements
There are currently no replacements for this command.
[ Learn more about replacements ]
Discussions
Do you have questions or do you want to suggest new features? Than head over to our new community:
[ jKit Community ]