Email address text box validation

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi i have created a form that sends an email to the address that the user
enters into the form, While this works fine i want to add a restriction on
the email addresses so they can only email our company email addresses eg
(e-mail address removed), I have checked the frontpage validation settings but
cant seem to get this to work, Any ideas would be much appreciated
 
Hi Rob,

You'd need to roll your own script for this. Something like

<script>
function checkAddress(f)[
if(!f.email.value || f.email.value.indexOf('YourCompany.com') <0){
alert('Please enter a valid email');
return false;}
return true;
}
</script>
<form onsubmit="return checkAddress(this);".....
<input type="text" name="email">
 
Rob said:
Hi i have created a form that sends an email to the address that the user
enters into the form, While this works fine i want to add a restriction on
the email addresses so they can only email our company email addresses eg
(e-mail address removed), I have checked the frontpage validation settings but
cant seem to get this to work, Any ideas would be much appreciated

Make the form like this:

<drop down box with users to chose from> @companyname.com [probably easiest
because then you can use the drop box to populate the email address.]

Or,

<box to enter email> @companyname.com

Or, use validation with the entire string "@companyname.com" in one of the
"general" validation boxes.

On a side note, be assured the spammers and email harvesting bots will do
their best to exploit a form like that.
 
Thanks for the help, The form will only be accessible from within our
intranet so security not to much of an issue on the form
Thanks

Sparky Polastri said:
Rob said:
Hi i have created a form that sends an email to the address that the user
enters into the form, While this works fine i want to add a restriction on
the email addresses so they can only email our company email addresses eg
(e-mail address removed), I have checked the frontpage validation settings but
cant seem to get this to work, Any ideas would be much appreciated

Make the form like this:

<drop down box with users to chose from> @companyname.com [probably easiest
because then you can use the drop box to populate the email address.]

Or,

<box to enter email> @companyname.com

Or, use validation with the entire string "@companyname.com" in one of the
"general" validation boxes.

On a side note, be assured the spammers and email harvesting bots will do
their best to exploit a form like that.
 
Rob said:
Hi i have created a form that sends an email to the address that the user
enters into the form, While this works fine i want to add a restriction on
the email addresses so they can only email our company email addresses eg
(e-mail address removed), I have checked the frontpage validation settings but
cant seem to get this to work, Any ideas would be much appreciated


Use a client-side JavaScript to validate the input. You can find many such
scripts at http://javascript.internet.com and other such sites.
 
Back
Top