We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.
I am trying to create a form where if the user selects either Email or Phone from the 'Email or Phone' radio button that the text field next to it would either validate an email address or a phone number (999) 999-9999.
My main difficulty is the script formating for the email address.
Can anyone please help?
'Email or Phone' thats name of radio buttons?
What should format for email look like?
Yes, that is the name.
The email form can be of any email. It can be literally any type of email, but understandably it needs an "@" and a "."
Why do you need to format an email address?
Attached is a file where the format of the field is checked in accordance with the choice of 2 radio buttons: Phone Number or Email Address.
2 possibilities, with an alert message from a custom validation script or with the typing management from a custom keystroke script.
I found the email format on the web but as I am not a specialist, I don't know if it is 100% correct. The masks are explained on the pdf file.
I understand using a validation script for an email address, but that's not the same as a Format script...
For example, you can't type 2 dots in a row in an email address...
Again, that's validation, not formatting. Format means you take the value the user entered and change it to appear differently, according to some pattern. For example, if they enter "1234567890" you can have it automatically show up as "(123) 456-7890". Doing that with an email address doesn't make sense.
You are right, that doesn't make sense and it's even impossible to create a mask for the email address because the script can't know where to place the @ and the dot before the domain, but at least this script avoids typing an incorrect email address even if it is wrong 😉
I corrected the script for the phone number format so we don't have to type parentheses, the space and the hyphen anymore.