1.1.2 • Published 6 years ago
oyi-ajax-forms v1.1.2
Oyi Ajax Forms
The jQuery Validation and Ajax Plugin provides drop-in validation for your existing forms, while making all kinds of customizations to fit your application really easy.
Usage
npm install oyi-ajax-forms --save
import 'oyi-ajax-forms';
or- use
<script>
Initialization
const subscribeForm = new OyiForms($('#subscribe-form'), { options });
Options
{
validate: {
// input error class
errorClass: 'input-error',
// input parent wrapper element (e.g. 'fieldset')
parentElement: 'div',
// element for error message
errorElement: 'div',
},
ajax: {
// type of ajax request
dataType: 'json'
},
// before send cb
beforeSend: (arr, form) => {},
// after send cb function
onSuccess: (form, response) => {},
// owerwrite default messages
e.g. messages: {required: 'Поле є повинне бути заповненим'}
messages: {}
}