bootstrap-validator
bootstrap-validator copied to clipboard
How can I know the form is valid success?
because I use button but not submit,here is my code:
$('#form').validator('validate'); dictionaryApi.saveOrUpdate({ //call this api to save the entity })
But when the form is invalid,it's still can save success,so I want to know if the form is valid,if not,I will return the function.Just like the formvalidation,the is a function named isValid(),
isValid(): Boolean — Check the form validity.
Can you help me?thanks so much.
$('#form').validator('validate');
// Execute the validation
if($('form').data('bs.validator').validate().hasErrors()) { // error goes here } else { // No errors do something.. }
Use the above code to handle the validation. This should be definitely placed in the docs to make it easier for people to find.
@krux20 Thank you so much,It's helpful
@krux20 Thank you!
@krux20 Thank you!