Bonjour � tous,
Voil� afin de faciliter au maximum l'inscription � la newsletter j'ai cr�er un petite boxe dans le header o� chacun rentre son email et click et qui fonctionne nikel.
mais le probl�me est que j'ai un script qui v�rifie la validit� de l'adresse mail, et ce script me fout le bazar d�s que j'ai un autre forme sur la page.
Exemple je suis sur la page de recherche, je rentre le produit rechercher, je click, et il me dis que l'e-mail est pas bon.
script place au niveau du header:
dans le corps du header:
Code : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66 <script language="JavaScript1.2" type="text/javascript"> function verify(form) { var passed = false; var blnRetval, intAtSign, intDot, intComma, intSpace, intLastDot, intDomain, intStrLen; if (form.Email){ intAtSign=form.Email.value.indexOf("@"); intDot=form.Email.value.indexOf(".",intAtSign); intComma=form.Email.value.indexOf(","); intSpace=form.Email.value.indexOf(" "); intLastDot=form.Email.value.lastIndexOf("."); intDomain=intDot-intAtSign; intStrLen=form.Email.value.length; // *** CHECK FOR BLANK EMAIL VALUE if (form.Email.value == "" ) { alert("You have not entered an email address."); form.Email.focus(); passed = false; } // **** CHECK FOR THE @ SIGN? else if (intAtSign == -1) { alert("Your email address is missing the \"@\"."); form.Email.focus(); passed = false; } // **** Check for commas **** else if (intComma != -1) { alert("Email address cannot contain a comma."); form.Email.focus(); passed = false; } // **** Check for a space **** else if (intSpace != -1) { alert("Email address cannot contain spaces."); form.Email.focus(); passed = false; } // **** Check for char between the @ and dot, chars between dots, and at least 1 char after the last dot **** else if ((intDot <= 2) || (intDomain <= 1) || (intStrLen-(intLastDot+1) < 2)) { alert("Please enter a valid Email address.\n" + form.Email.value + " is invalid."); form.Email.focus(); passed = false; } else { passed = true; } } else { passed = true; } return passed; } </script>
Voyez vous un moyen pour que la v�rification de l'adresse email ne s'applique que lorsque l'on click sur le bouton ok?.
Code : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 <?php if ((tep_session_is_registered('customer_id'))||($_COOKIE["deja_inscrit"] == "oui")||(basename($PHP_SELF) == "login.php")||(basename($PHP_SELF) == "contact_us.php")||(basename($PHP_SELF) == "tell_a_friend_website.php")||(basename($PHP_SELF) == "newsletters.php")||(basename($PHP_SELF) == "surmesure.php")||(basename($PHP_SELF) == "contact_us.php")) { echo '<font color="#bb0000"><b>'.PHRASE_HEADER1.'</b><img src="images/pixel_trans.gif" border="0" width="10" height="2">'; } else { <form NAME="newsletter" ACTION="<? echo tep_href_link(FILENAME_NEWSLETTERS_SUBSCRIBE, '', 'NONSSL'); ?>" METHOD="post" onSubmit="return verify(this);"> */?> <input type="hidden" name="submitted" value="true"> <input type="hidden" name="email_type" value="HTML"> <table cellspacing=0 cellpadding=0 border=0 class="topBarTitle"> <tr> <td><P CLASS="main"><B><? echo 'E-mail'; ?></P></td> <td> </td> <td><input type="text" name="Email" value="@" style="color: white; background-color: black; text-align: center; font-size: 10px; font-style: bold; height:18;" size="10"></td> <td align="right" width="30"><?php echo '<input type="image" border="0" src="includes/languages/'.$language.'/images/buttons/button_ok.gif" name="submit">'. tep_draw_separator('pixel_trans.gif', '10', '1'); ?>
P.S: D�sol� si je poste pas au bon endroit, mais ma page est en php, avec un input en html, et un script en Js
Partager