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

Validate partial text in field / Field must contain @

Community Beginner ,
Mar 14, 2024 Mar 14, 2024

Copy link to clipboard

Copied

Hi 

 

Not sure if this is validate or something else.

 

Want to be able to make sure that people paste in an email address in a text field and not just a persons name - how do I go about this.

 

I was going down the route of  : If in the "Email Address" text box there is no "@" it will flag that the form has not been filled in correctly (been googling and cannot find anything to help) and subsequently cannot be submitted to another user via a separate submit button

TOPICS
PDF forms

Views

184

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 , Mar 14, 2024 Mar 14, 2024

See if something like this works for you (use as validate script):

var email = event.value;
var isValidEmail = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(email);

if(!isValidEmail && email !== "") {
 app.alert("Please enter a valid email address.");
 event.rc = false;}

Votes

Translate

Translate
Community Expert ,
Mar 14, 2024 Mar 14, 2024

Copy link to clipboard

Copied

LATEST

See if something like this works for you (use as validate script):

var email = event.value;
var isValidEmail = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(email);

if(!isValidEmail && email !== "") {
 app.alert("Please enter a valid email address.");
 event.rc = false;}

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