• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Forms - Email address field

Community Beginner ,
Jan 26, 2021 Jan 26, 2021

Copy link to clipboard

Copied

I'm creating a form that has an email address field. Form users will all have addresses at the same domain. I'm struggling with a way to make the domain show up after typing the first part of the email address.

 

For instance, I'd like to be able to type "myemail" and then have "@company-name.com" automatically append to the text.

 

I've tried using an arbitrary mask, but that either doesn't work, or I'm typing the wrong syntax. Can anyone point me in the right direction?

TOPICS
PDF forms

Views

2.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jan 26, 2021 Jan 26, 2021

To use the Arbitrary mask you must know the exact number of caracters to be entered before the @

 

Remove the Arbitrary mask and use this as a Validation script Custom Format script :

 

event.value = event.value + "@company-name.com";

 

 

Votes

Translate

Translate
Community Expert ,
Jan 26, 2021 Jan 26, 2021

Copy link to clipboard

Copied

To use the Arbitrary mask you must know the exact number of caracters to be entered before the @

 

Remove the Arbitrary mask and use this as a Validation script Custom Format script :

 

event.value = event.value + "@company-name.com";

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 26, 2021 Jan 26, 2021

Copy link to clipboard

Copied

Perfect. Thank you! I would have struggled for the rest of the day on this.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 26, 2021 Jan 26, 2021

Copy link to clipboard

Copied

Does the value of the field need to change or just the way it is displayed?

If the latter then I would recommend using this code as a Format script, not Validation.

Why not? Try the following:

Enter something into the field and then exit it. Let's say you entered "joe".

The field now shows "joe@company-name.com". All good so far.

But wait, you remembered that your email address is actually joe1@company-name.come  !

No problem, you go back to the field and fix it. What happens when you exit the field?

Oops, it's now "joe1@company-name.com@company-name.com"... The script adds the domain each time you edit the field's value, no matter what it already shows.

To make it work correctly you would need to not just add the domain, but also remove it if it already exists, or use a Format script. I would also add a condition not to add the domain suffix in case the field is empty.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 26, 2021 Jan 26, 2021

Copy link to clipboard

Copied

Awesome!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 27, 2021 Jan 27, 2021

Copy link to clipboard

Copied

LATEST

Yes, I made a mistake, use it as a "Custom format script".

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines