SOLVED

Re: Form-Phone Number Variations

Go to solution
SanfordWhiteman
Level 10 - Community Moderator

Re: Form-Phone Number Variations

Because you have another JS script loaded via GTM (you must keep track of those!) that's overriding the validation and setting the form back to submittable.

pastedImage_1.png

No idea what the above is supposed to do, but you need to make sure all your custom form behaviors cooperate with each other.

tarajosealander
Level 1

Re: Form-Phone Number Variations

Is there a way to require the number to be real and US based? I can lock it to 10 digits, but will that ensure it is an actual us based phone number?

SanfordWhiteman
Level 10 - Community Moderator

Re: Form-Phone Number Variations

You can't do this validation with Marketo alone. There are various remote services that can do so — for example, the Twilio Lookup API.

jdm739
Level 1

Re: Form-Phone Number Variations

Hi Sanford, 

 

Thank you for your code - it works. But I'm running into an issue where if it's on a landing page template that hosts multiple different forms without phone number as a field, the form will not submit. Is there someway to alter the code to be conditional to run only if phone number is in the form? Thanks!

SanfordWhiteman
Level 10 - Community Moderator

Re: Form-Phone Number Variations


Is there someway to alter the code to be conditional to run only if phone number is in the form? Thanks!

Sure, you can check if the Phone number exists at all in the initial form field set. I updated the Pen accordingly.

 

stephaniadamcik
Level 1

Re: Form-Phone Number Variations

Perfect - thank you!