jquery - start form validation only on submit -
my form starting validation (with plugin) minute user start typing. example if have password input , retype password input, when typing first character on password show 'password mismatch' user didn't have chance type retype password.
how disable validation on typing , show errors when user click on submit? there options?
but, username remote check want show error when input if out of focus
$('#frm_user_details').formvalidation('validate'); $('#frm_user_details').formvalidation({ framework: 'bootstrap', fields: { register_first_name: { validators: { notempty: { message: 'please enter first name' } } }, register_last_name: { validators: { notempty: { message: 'please enter last name' } } }, username: { validators: { notempty: { message: 'please enter username.' }, remote: { type: 'post', url: '/core/services/validator.php', message: 'that username taken.', delay: 500 } } }, register_password: { validators: { notempty: { message: 'the password required , cannot empty' }, identical: { field: 'register_password_retyped', message: 'the password , confirm must same' } } }, register_password_retyped: { validators: { notempty: { message: 'the confirm password required , cannot empty' }, identical: { field: 'register_password', message: 'the password , confirm must same' } } }, }, onerror: function(e) { e.preventdefault(); $('#create_account').removeclass('button-disabled'); }, onsuccess: function(e) { e.preventdefault(); $('#create_account').addclass('button-disabled'); this.services.submithandler(); } } });
here in api docs describing settings object structure it's mentioned : live
property should disabled
prevent validation on user typing. - disable live validating. error messages shown after form submitted
$(formselector).formvalidation({ live : disabled, //other properties
Comments
Post a Comment