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

Forms - Email address field

Community Beginner ,
Jan 26, 2021 Jan 26, 2021

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
3.1K
Translate
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
1 ACCEPTED SOLUTION
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";

 

 


PDF Acrobatic, InDesigner & Photoshoptographer

View solution in original post

Translate
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

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";

 

 


PDF Acrobatic, InDesigner & Photoshoptographer
Translate
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

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

Translate
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

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.

Translate
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

Awesome!

Translate
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
LATEST

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


PDF Acrobatic, InDesigner & Photoshoptographer
Translate
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