How to add custom validation on mobile number field?

You use this procedure to add validation on mobile or phone number field and restrict it to be 10 digit number.


  • You have created a form with mobile or phone number field in it.


Edit your landing page and go to Step 04 (Page Settings)
Scroll down to find ‘Embed Java Script’ option
Paste this snippet of code by selecting ‘End of Body’


$(“#frmcontainer1”).submit( function (event){

var mobileNumber = $(“#Mobile“).val().trim();

if (!(/^\d{10}$/).test(mobileNumber))


$(“#Alert_Valid_Mobile”).addClass (“show”);





After adding the script, go to further steps and Publish/Republish the landing page.


  • If you have added ‘Phone number’ field in the form, use Phone instead of Mobile as shown as above highlighted area in yellow.
  • It must be added in the End of the Body.
  • frmcontainer1 is the ID of the form.
  • Mobile is the name of the mobile number field. Phone will be the name of Phone number field. Schema name can be used for custom fields.
  • Alert_Valid_Mobile is the label that shows validation message. Alert_Valid_Phone will be the label to show the validation message for Phone field.

Was this Helpful?