Geeks!
We all know that awesome plugin called International Telephone Input,is there a way to tie it's own Validation method intlTelInput("isValidNumber")
into jquery validation ?
intlTelInput("isValidNumber")
returns true if true or false if false
There is more details yet to come below!:
var handleContactFormValidation = function () {
var value_form = $('#contact_form');//form i would like to validate where phone field is in!
var value_error = $('.alert-danger', value_form);
var value_success = $('.alert-success', value_form);
value_form.validate({
errorElement: 'span', //default input error message container
errorClass: 'help-block help-block-error', // default input error message class
focusInvalid: false, // do not focus the last invalid input
ignore: "", // validate all fields including form hidden input
rules: {
phone: {
required: {
depends: function () {
if ($(this).intlTelInput("isValidNumber") == true)
return true
else
return false
}
}
},
},
Now depending on the results "isValidNumber" method is returning i need to pass that validating Output {true,false} to the jquery validation but above is not functioning