Its not an e-mail address if it does nor contains @ - Ho to do this....

  • Thread starter Thread starter Carlos Arruda
  • Start date Start date
C

Carlos Arruda

Hello.
I have this form, www.carlos-arruda.com/comentarios.htm, and in the field
e-mail i would like to make it in a way that if it does not contains the @
it does not acept and returns an error en relation to that. Does frontpage
does that or do i have to ad html?
Don't know much of html as i am just begening to learn.
Cheers
C Arruda
 
-----Original Message-----
Hello.
I have this form, www.carlos-arruda.com/comentarios.htm,
and in the field e-mail i would like to make it in a way
that if it does not contains the @ it does not acept and
returns an error en relation to that. Does frontpage
does that or do i have to ad html?
Don't know much of html as i am just begening to learn.
Cheers
C Arruda

FrontPage doesn't have this capability built-in. You would
have to write some JavaScript or ASP code that does this,
find some code already written that does it, or find a 3rd-
party component.

Jim Buyens
Microsoft FrontPage MVP
(e-mail address removed)
http://www.interlacken.com
Author of:
*------------------------------------------------------*
|\----------------------------------------------------/|
|| Microsoft Office FrontPage 2003 Inside Out ||
|| Microsoft FrontPage Version 2002 Inside Out ||
|| Web Database Development Step by Step .NET Edition ||
|| Troubleshooting Microsoft FrontPage 2002 ||
|| Faster Smarter Beginning Programming ||
|| (All from Microsoft Press) ||
|/----------------------------------------------------\|
*------------------------------------------------------*
 
Put this into your <head> section:

<SCRIPT language="JavaScript" TYPE="text/javascript">
<!--
function validate_form() {
validity = true;
if (!check_email(document.form.email.value))
{ validity = false; alert('Please enter a valid email address');
document.form.email.focus(); }
return validity;
}

function check_email(address) {
if ((address == "")
|| (address.indexOf ('@') == -1)
|| (address.indexOf ('.') == -1))
return false;
return true;
}
// -->
</SCRIPT>

Add this to your form:
onSubmit="return validate_form()"

Change this line to refer to the name of your email field:
document.form.email.value
^^^

This should pop up alert box if the email address does not contain an @ and
at least one .

Obviously if your viewer does not have Javascript enabled, this will not be
called.

HTH.
PWT.
 
Peter,

This is great as long as you are not using the FP Form Field Validation on
the same form.

To use this FP's Form Field Validation, you add the FP Field Validation,
preview form in IE, save source, then add your script, then in FP remove all
FP form field validation from the form, then change the form name and rename
the modified script, then insert into Form page in HTML View..

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================
 
Back
Top