Page 1 of 1

Email Address Field?

Posted: 2013-05-05 00:35
by MsMetaP
Can someone please tell me how to make a required field that will only accept a valid email address? Thanks!

Re: Email Address Field?

Posted: 2013-06-03 01:13
by shasta59
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