Copy link to clipboard
Copied
Hello,
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?
Drew
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.
@+
Copy link to clipboard
Copied
'Email or Phone' thats name of radio buttons?
What should format for email look like?
Copy link to clipboard
Copied
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 "."
Copy link to clipboard
Copied
Why do you need to format an email address?
Copy link to clipboard
Copied
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.
@+
Copy link to clipboard
Copied
I understand using a validation script for an email address, but that's not the same as a Format script...
Copy link to clipboard
Copied
For example, you can't type 2 dots in a row in an email address...
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
@+