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

arbitrary mask for an email address of random length

New Here ,
Feb 14, 2018 Feb 14, 2018

I would like to create an email address that allows random lengths before and after the @ symbol.

TOPICS
PDF forms
4.4K
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 ,
Feb 14, 2018 Feb 14, 2018

If you want to make sure it includes a period in the second part use this, instead:

if (event.value) {

    event.rc = /^.+@.+\..+$/.test(event.value);

}

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 ,
Feb 14, 2018 Feb 14, 2018

You can't use an arbitrary mask for that. You need to use a custom validation script.

The most basic validation would be against the RegExp /^.+@.+$/.

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
New Here ,
Feb 14, 2018 Feb 14, 2018

I guess I should have been more specific.  I was wanting to create a field with a script that would validate and email address of random length.  i.e., verifying _________@_____.____ where the underline areas are any character/length and the "@" and "." are known and expected for validation.  Thanks.  Not sure how to implement RegExp /^.+@.+$/

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 ,
Feb 14, 2018 Feb 14, 2018

I understood that, and the RegExp I provided will do it.

Use this code as your field's custom validation script:

if (event.value) {

    event.rc = /^.+@.+$/.test(event.value);

}

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 ,
Feb 14, 2018 Feb 14, 2018

If you want to make sure it includes a period in the second part use this, instead:

if (event.value) {

    event.rc = /^.+@.+\..+$/.test(event.value);

}

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
New Here ,
Mar 21, 2020 Mar 21, 2020
LATEST

Thanks for 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