Hi,
I currently using Marketing Forms/Pages within Dynamics 365 Marketing and I've noticed that client can submit Text in field "mobile phone".
Let's say that you have a sign up form containing phone numbers and the Marketing Form Fields. How can you then validate that people submit the form with the correct number value in mobile phone field?
Thanks in advance,
Regards,
DB.
Hi Partner,
You can achieve it easily through Editing phone field in HTML editor of marketing form:
(1)Check the HTML of the marketing form, the phone type is 'tel':
Then i add pattern
attribute to the <input>
tag, which specifies a regular expression:
Note: The pattern
attribute works with the following input types: text, date, search, url, tel, email, and password.'
My example: placeholder="123-45-678" pattern="[0-9]{3}-[0-9]{2}-[0-9]{3}"
When i try to submit form with wrong format phone number, message will appear:
Correct format:
(2) Or you can change type to 'number', then the phone field will only allow numeric input.
Test:
===========================
For complex validation, we can achieve it with form API and custom logic.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156