Hello Brouillard,
The file "newsleter_boxe.php" in its contribution is wrong, I managed to work well with this file below, but it still has an error, if not put anything in the field of e-mail it works fine and the correct phrase appears in the pop-up, but if you put comma or space does not report the correct phrase but the "BOX_NEWSLETTER_ERREUR_VIRGULE" to comma and "BOX_NEWSLETTER_ERREUR_ESPACES" for spaces. I do not know what's wrong but the file below works best:
Oscar Rocha
São Paulo - Brazil
<?php
/*
$Id: boxe newsletter.php le 05 Avril 2012
Auteur : Brouillard s'embrouille (
[email protected])
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright © 2012 osCommerce
Released under the GNU General Public License
*/
?>
<!-- boxe newsletter //-->
<script type="text/javascript">
function VerifierMail(form) {
if (form.emailabonnement.value == "" ) {
alert("<?php echo BOX_NEWSLETTER_ERREUR_CHAMP_VIDE; ?>")
form.emailabonnement.focus();
return false;
}
else if (form.emailabonnement.value.indexOf(",") > 0) {
alert("' . BOX_NEWSLETTER_ERREUR_VIRGULE . '")
form.emailabonnement.focus();
return false;
}
else if (form.emailabonnement.value.indexOf(" ") > 0) {
alert("' . BOX_NEWSLETTER_ERREUR_ESPACES . '")
form.emailabonnement.focus();
return false;
}
else if (form.emailabonnement.value.indexOf("@") < 0) {
alert("' . BOX_NEWSLETTER_ERREUR_AROBASE . '")
form.emailabonnement.focus();
return false;
}
else if (form.emailabonnement.value.lastIndexOf(".") < 0) {
alert("' . BOX_NEWSLETTER_ERREUR . '")
form.emailabonnement.focus();
return false;
}
else if ((form.emailabonnement.value.length - 1) - form.emailabonnement.value.lastIndexOf(".") < 2) {
alert("' . BOX_NEWSLETTER_ERREUR . '")
form.emailabonnement.focus();
return false;
}
else {
// form.submit()
return true;
}
}
</script>
<tr>
<td>
<?php
$info_box_contents = array();
$info_box_contents[] = array('align' => 'left',
'text' => BOX_HEADING_NEWSLETTER
);
new infoBoxHeading($info_box_contents, false, false);
$info_box_contents = array();
$info_box_contents[] = array('align' => 'center',
'text' => BOX_NEWSLETTER_TEXT_ABONNEMENT . '<br><br>' . tep_draw_form('newsletterabonnement', tep_href_link(FILENAME_NEWSLETTER_ABONNEMENT, '', 'NONSSL'), 'post', 'onsubmit="return VerifierMail(this);"') . BOX_NEWSLETTER_TEXT_EMAIL . '<br>' . tep_draw_input_field('emailabonnement', '', 'size="20" maxlength="50"') . '<br>' . tep_image_submit('sinscrire_newsletter.gif', IMAGE_BUTTON_CONTINUE, 'SSL') . '</form>');
new infoBox($info_box_contents);
?>
</td>
</tr>
<!-- boxe newsletter eof //-->