Jump to content

Control problem based on two forms


jacque99

Recommended Posts

Control problem based on two forms

 

Hello everyone,

I have a problem with the control of my two forms

principle it is good for the first form, but if I wanted to control my 2nd form, blocking ca

Here's the script:

 

<html>
<head>
<script type="text/javascript" >
function formValidation1(oEvent) {
oEvent = oEvent || window.event;
var txtField = oEvent.target || oEvent.srcElement;

var txt_nom_pereck1=true;
var msg=" ";
if(document.getElementById("txt_nom_pere").value.length < 3 ){ txt_nom_pereck1=false; msg = msg + "Your name should be minimun 3 char length";}
if(document.getElementById("txt_prenom_pere").value.length < 3 ){ txt_nom_pereck1=false; msg = msg + "Your name should be minimun 3 char length";}


if(txt_nom_pereck1){document.getElementById("submit_etape4").style.display='block'; }
else{document.getElementById("submit_etape4").style.display='none'; }
}

window.onload = function () {


var submit_etape4 = document.getElementById("submit_etape4");

var txt_nom_pere = document.getElementById("txt_nom_pere");
var txt_prenom_pere = document.getElementById("txt_prenom_pere");

var txt_courriel_pere = document.getElementById("txt_courriel_pere");
var txt_courriel_pere_conf = document.getElementById("txt_courriel_pere_conf");



var txt_nom_pereck1=false;
document.getElementById("submit_etape4").style.display='none';
txt_nom_pere.onkeyup = formValidation1;
txt_prenom_pere.onkeyup = formValidation1;

}

//************Partie 2 : ******/////////////////////////////

/*
function formValidation2(oEvent) {
oEvent = oEvent || window.event;
var txtField = oEvent.target || oEvent.srcElement;

var txt_nom_pereck2=true;
var msg=" ";

if(document.getElementById("txt_courriel_pere").value.length < 3 ){ txt_nom_pereck2=false; msg = msg + "Your name should be minimun 3 char length";}
if(document.getElementById("txt_courriel_pere_conf").value.length < 3 ){ txt_nom_pereck2=false; msg = msg + "Your name should be minimun 3 char length";}


if(txt_nom_pereck2){document.getElementById("submit_etape5").style.display='block'; }
else{document.getElementById("submit_etape5").style.display='none'; }
}

window.onload = function () {


var submit_etape5 = document.getElementById("submit_etape5");

var txt_courriel_pere = document.getElementById("txt_courriel_pere");
var txt_courriel_pere_conf = document.getElementById("txt_courriel_pere_conf");



var txt_nom_pereck2=false;
document.getElementById("submit_etape5").style.display='none';
txt_nom_pere.onkeyup = formValidation2;
txt_prenom_pere.onkeyup = formValidation2;
}

Je voulais activer cette partie pour comtrole le Form 2
Le probleme existe au niveau des nom des fonctions

I wanted this part to enable the Comtrol Form 2
The problem exists at the level of function names
*/
</script>

</head>
<body >
<form method=" post" action="form-success.php">
<table>
<tr>
<td>First Name</td>
<td><input type="text" id="txt_nom_pere" name="FirstName"></td>
</tr>
<tr>
<td>First Name</td>
<td><input type="text" id="txt_prenom_pere" name="FirstName"></td>
</tr>
</table>
<input type="button" id="submit_etape4" value="Sign Up!!" style="display:none;"  /> 
</form>




<form method=" post" action="form-success.php">
<table>
<tr>
<td>First Name</td>
<td><input type="text" id="txt_courriel_pere" name="FirstName"></td>
</tr>
<tr>
<td>First Name</td>
<td><input type="text" id="txt_courriel_pere_conf" name="FirstName"></td>
</tr>
</table>
<input type="button" id="submit_etape5" value="Sign Up!!" style="display:none;"  /> 
</form>


</body>
</html> 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.