Email Address Field?

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
MsMetaP
Posts: 9
Joined: 2013-05-05 00:30

Email Address Field?

Post by MsMetaP » 2013-05-05 00:35

Can someone please tell me how to make a required field that will only accept a valid email address? Thanks!

User avatar
shasta59
AppGini Super Hero
AppGini Super Hero
Posts: 231
Joined: 2013-01-08 19:40
Location: Calgary, Alberta, Canada

Re: Email Address Field?

Post by shasta59 » 2013-06-03 01:13

Sure. Go into AppGini and check off the the field must not be empty.

Then you need a entry checking routine.

Here is a routine to do this as javascript. This is a very basic one which can be built upon. It is found here:

http://www.w3schools.com/js/js_form_validation.asp

Code: Select all

function validateForm()
{
var x=document.forms["myForm"]["email"].value;
var atpos=x.indexOf("@");
var dotpos=x.lastIndexOf(".");
if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
  {
  alert("Not a valid e-mail address");
  return false;
  }
}
I have written my own based upon the above and it is a bit more complex but this is the basic construction you need.

Hope this helps a bit. You can then add in a routine to use the above code as the user moves to another field. (leaves the email address field)

Alan
Calgary, Alberta, Canada - Using Appgini 5.50 -

Post Reply