Link to home
Start Free TrialLog in
Avatar of etubex
etubex

asked on

How to compare two fields (email adresses) in a Frontpage form (no validation-just make shure they are the same) before (!!) onsubmit checking ?

I want two see if the content of two fields email_01 and email_02 is the same in a Frontpage form. No validation of the email adres needed. Just compare the two fields.
I would like the check to be made before clicking the submit button since onsubmit is handled to my knowledge by the FP server extensions webbot and I do not know if its alowed to change anything here.I want to make shure no mistakes are made in typing an email adres.
Hope this is clear since I'm Dutch speaking.
Avatar of coreybryant
coreybryant
Flag of United States of America image

You will need to use a Javacript.  Something like:
<head>
script type="text/javascript" language="JavaScript">
<!--
function checkEmail(theForm) {
    if (theForm.EMAIL_1.value != theForm.EMAIL_2.value)
    {
        alert('Those emails don\'t match!');
        return false;
    } else {
        return true;
    }
}
//-->
</script>
</head>
<body>

<form action="../" onsubmit="return checkEmail(this);">
<p> Enter Your Email Address:<br>
<input type="TEXT" name="EMAIL_1" size="20" maxlength="20">
<br>
Please Confirm Your Email Address:
<br>
<input type="TEXT" name="EMAIL_2" size="20" maxlength="20">
<br>
<input type="SUBMIT" value="Send Address!"></p>
</form>
</body>
-Corey
Avatar of etubex
etubex

ASKER

Sorry, I'm not an expert.
Now I have in my form <FORM METHOD="POST" name="FrontPage_Form1" action="--WEBBOT-SELF--" onSubmit="return FrontPage_Form1_Validator(this)">

Where and how do I put the line from this javascript <form action="../" onsubmit="return checkEmail(this);"> ??

Well you already have an action in there.  (action="--WEBBOT-SELF--" ) - what else are you validating?  I am not certain if yo can use two different 'validators' on the same form

-Corey
Avatar of etubex

ASKER

Sorry,This doesn't workwith me. Apparently you cannot have two onsubmit handlers on one form. Also my question was if its possible to compare the two fields BEFORE onsubmit.
Maybe it isn't ?
Yes it is.  The code I gave you will but since you are using Fp form verification - and that does not allow it - you will eed to consider a JS function for everthing.

What are the fields you are needing to verify?  

-Corey
Avatar of etubex

ASKER

the fields are email_01 and email_02
Eric
But what else you are trying to verify?  return FrontPage_Form1_Validator(this) - this usually means you want other fields to be validated?  If you are not trying to verify any other fields - take this out & then you can use the code I gave you.

-Corey
Avatar of etubex

ASKER

There are some required fields in the form, for example
<!--WEBBOT
  BOT="Validation" B-Value-Required="TRUE" --><INPUT TYPE="text" NAME="Straat" SIZE="60" TABINDEX="3">
fields that may not be empty.Its basically a form for online sollicitation where we want the user obligatory tell us his name,birtdate,street,phonenumber etc... All those fields are marked as required. I guess thats what's the FP Bot is validating.
Eric
ASKER CERTIFIED SOLUTION
Avatar of coreybryant
coreybryant
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial