Page 1 of 1
Email Validation using Request JavaScript
Posted: Tue Mar 18, 2014 6:04 pm
by John-Paul Sliva
Can't get the, Request JavaScript , to filter email addresses entered in an, email input component. I want the email to fail if the if statement is false, then an alert will show.
JavaScript below
if (/\w+([.-]?\w+)*@bard.edu$/.test.value);
return value;
HELP?
Email Validation using Request JavaScript
Posted: Tue Mar 18, 2014 6:36 pm
by Maryna Brodina
Hello!
Try /\w+([.-]?\w+)*@bard.edu$/.test(value)
value should be in brackets.
Email Validation using Request JavaScript
Posted: Tue Mar 18, 2014 7:02 pm
by John-Paul Sliva
NO LUCK.
Below is what I am doing:
Enter Email and Password: clicking sign up
Connecting inputs to request Username & Password
***NEED JavaScript to stop any emails from entering my database that do not end with (@bard.edu). ????
Email Validation using Request JavaScript
Posted: Wed Mar 19, 2014 12:08 am
by Illya Stepanov
Hi John,
You should validate your form before you invoke the service.
So for "click" event on your button you should set type "JavaScript" and do the form validation in this JS.
If it passed, invoke your service with this JS code:
pre
serviceName.execute();
/pre
Email Validation using Request JavaScript
Posted: Wed Mar 19, 2014 10:13 pm
by John-Paul Sliva
Not sure if my JS is right?
Email Validation using Request JavaScript
Posted: Wed Mar 19, 2014 10:14 pm
by John-Paul Sliva
Email Validation using Request JavaScript
Posted: Wed Mar 19, 2014 10:34 pm
by Alena Prykhodko
Hi John.
Yes, code is correct.
Email Validation using Request JavaScript
Posted: Sat Mar 22, 2014 7:30 pm
by John-Paul Sliva
I am just not very good at JavaScript,
here is my latest attempt to filter emails that do not end with @bard.edu
Any advice?
Email Validation using Request JavaScript
Posted: Sun Mar 23, 2014 10:26 pm
by Igor
Hard coded value "username" in your code should be replaced with your real username value:
pre
code
...
if(/\w+([.-]?\w+)*@bard.edu$/.test("username"))
...
/code
/pre