jQuery plugin used in GestiXi websites to handle form submission.
npm install form-submitterForm Submitter
==============
This plugin make it easy to submit form in GestiXi generated websites.
------
form-submitter depends on jQuery. To use it, include this in your page :
------
To use Form Submitter, you just need to do this:
$(function() {
$(".form-container").formSubmitter({
// options if needed
});
});
The receiver can be either a form or a DOM element containing a form.
Your server will have to respond a JSON encoded object with the following optionnals parameters :
- notification: an HTML Bootstrap alerts.
- helpInline: a JSON encoded object with the name of the input field as a key and the error as a value.
- redirectUrl: on URL to redirect the page to.
If this is too opinionated for you, feel free to fork it and adapte it to your use case.
------
Delegate called before form submission.
Return false to prevent form submitting.
Example:
$('form').formSubmitter({
willSend: function() {
return true;
}
});
Delegate called to get the form data.
Example:
$('form').formSubmitter({
formSettings: function(evt) {
var $form = this.$form;
return {
method: $form.attr("method"),
url: $form.attr("action"),
data: $form.serialize()
};
}
});
Delegate called after form submission.
Delegate called before the response handling.
Delegate called after the response handling.
Layout of the notifications.
Default: 'position:fixed;top:10px;left:10px;width:350px;z-index:1000;'
------
The DOM element.
Example:
$('form').formSubmitter({
didSend: function(evt) {
console.log(this.element);
}
});
The jQuery form element.
Example:
$('form').formSubmitter({
didSend: function(evt) {
console.log(this.$form);
}
});
The options object.
------
Nicolas Badia
+ https://twitter.com/@nicolas_badia
+ https://github.com/nicolasbadia
------
Copyright 2013-2015 GestiXi under The MIT License (MIT).