Skip to main content
Participant
March 14, 2024
Answered

Validate partial text in field / Field must contain @

  • March 14, 2024
  • 1 reply
  • 395 views

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

This topic has been closed for replies.
Correct answer Nesa Nurani

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

1 reply

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
March 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;}