Open indumathymk opened 3 years ago
No, you need to use a service like Twilio verify or something similiar.
This cannot be verified by this repo, maybe it need to be validated via paid service.
You can build a cx function that take the number entered in the input field. Then the number is used an argument which goes to a function and check length and pattern of the number entered. If the patterns has mobile length, consider as mobile else consider it a landline. This is how i have made. I used a single to input to identlify that entered input is a email or phone. Something like this.
validate_input1(email, phone) {
var intRegex = /[0-9 -()+]+$/;
if (intRegex.test(phone)) {
// console.log("is phone", email);
var obj1 = {
mobile: phone,
};
if (phone.length < 9 || !intRegex.test(phone)) {
alert("Please enter a valid phone number.");
//return false;
}
return obj1;
}
if (email) {
var eml = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
// console.log("is email enterted", email);
var obj2 = {
email: email,
};
// console.log('get obj',obj);
if (eml.test(email) == false) {
alert("Please enter valid email address.");
}
return obj2;
}
}
Is there is an option to validate given phone number is Mobile or Landline?