-
Notifications
You must be signed in to change notification settings - Fork 146
Events
Jony edited this page Jan 10, 2015
·
5 revisions
After verification each time a field would trigger this event, this event need to bind on the form, you can use this event to verify the results of real-time monitoring of the form.
$("#form").on("validation", function(e, field){
// if the whole form is valid
console.log(this.isValid);
// if the current field is valid
console.log(field.isValid);
})
Triggered after the form is valid.
$('#form').on('valid.form', function(e, form){
//do something...
});
Triggered after the form is invalid.
$('#form').on('invalid.form', function(e, form, errors){
//do something...
});
Triggered after the field is valid.
$('#username').on('valid.field', function(e, result){
//do something...
});
Triggered after the field is invalid.
$('#username').on('invalid.field', function(e, result){
//do something...
});
Triggered after the rule is valid.
$('#username').on('valid.rule', function(e, ruleName){
if (ruleName === 'remote') {
//do something...
}
});
Triggered after the rule is invalid.
$('#username').on('invalid.rule', function(e, ruleName){
if (ruleName === 'remote') {
//do something...
}
});
// Verify the selected field.
$('#username').trigger("validate");
// Verify the selected form.
$('#form').trigger("validate");
// Verify the selected area.
$('#area').trigger("validate");
// Tips ok message
$("#username").trigger("showmsg", ["ok", "Great name"]);
// Tips error message
$("#username").trigger("showmsg", ["error", "Name is already taken"]);
// Tips general message
$("#username").trigger("showmsg", ["tip", "Others make a good name for you impressed"]);
// Tips tip message has been bound (data-tip)
$("#username").trigger("showmsg", ["tip"]);
// Tips all tip message
$("#form").trigger("showmsg", ["tip"]);
// Hide field message
$("#username").trigger("hidemsg");
// Hide all messages form the form
$("#form").trigger("hidemsg");