Hi,
I'm getting an error displayed in the task bar when I click submit in a form (only when submit is clicked). The form processes and redirects as normal, and at such a speed that I'm unable to read the error type that flashes up.
Code I'm using is included below. Can anyone shed any light?
Thanks in advance,
Gary Crighton
// Declaring form
<form name="application" action="/production/socio/suscribase2.php?lang=<?PHP echo $lang?>" method="post" onSubmit="return submitForms();">
// Sumbit code
<input type="submit" name="submit" value="<?php if ($lang == "en" { ?> Next <? } else { ?> Siguiente <? } ?>">
// Validation script
<!--
function submitForms(){
if (lang == "en" {
var error1 = "Please enter your name";
var error2 = "Please enter your street address";
var error3 = "Please enter your postcode";
var error4 = "Please enter your town";
var error5 = "Please enter your State / County:";
var error6 = "Please enter your NIF";
var error7 = "You must provide either a telephone number or an email address";
var error8 = "Your email address is invalid";
var error9 = "Please choose your membership type";
} else {
var error1 = "ES Please enter your name";
var error2 = "ES Please enter your street address";
var error3 = "ES Please enter your postcode";
var error4 = "ES Please enter your town";
var error5 = "ES Please enter your State / County:";
var error6 = "ES Please enter your NIF";
var error7 = "ES You must provide either a telephone number or an email address";
var error8 = "ES Your email address is invalid";
var error9 = "ES Please choose your membership type";
}
if(document.application.name.value == "" {
alert(error1);
document.application.name.select();
return false;
}
if(document.forms.application.direccion.value == "" {
alert(error2);
document.application.direccion.select();
return false;
}
if(document.application.codigo_postal.value == "" {
alert(error3);
document.application.codigo_postal.select();
return false;
}
if(document.application.poblacion.value == "" {
alert(error4);
document.application.poblacion.select();
return false;
}
if(document.application.provincia.value == "" {
alert(error5);
document.application.provincia.select();
return false;
}
if ((lang != "en" && (document.application.nif.value == "") {
alert(error6);
document.application.nif.select();
return false;
}
//MAKING EITHER TELEPHONE OR EMAIL MANDATORY
if ((document.application.telefono.value == "" && (document.application.email.value == "") {
alert (error7);
document.application.telefono.select();
return false;
}
//BUT, IF AN EMAIL ADDRESS IS ENTERED IT SHOULD BE CHECKED
if ((document.application.email.value != "" && (document.application.email.value.indexOf ('@',0) == -1 || document.application.email.value.indexOf ('.',0) == -1)) {
alert (error8);
document.application.email.select();
document.application.email.select();
return false;
}
//WHY DOESN'T THIS WORK?
if ((document.application.cuota[0].checked == false)
&& (document.application.cuota[1].checked == false)
&& (document.application.cuota[2].checked == false)
&& (document.application.cuota[3].checked == false)) {
alert (error9);
return false;
}
}
// -->
I'm getting an error displayed in the task bar when I click submit in a form (only when submit is clicked). The form processes and redirects as normal, and at such a speed that I'm unable to read the error type that flashes up.
Code I'm using is included below. Can anyone shed any light?
Thanks in advance,
Gary Crighton
// Declaring form
<form name="application" action="/production/socio/suscribase2.php?lang=<?PHP echo $lang?>" method="post" onSubmit="return submitForms();">
// Sumbit code
<input type="submit" name="submit" value="<?php if ($lang == "en" { ?> Next <? } else { ?> Siguiente <? } ?>">
// Validation script
<!--
function submitForms(){
if (lang == "en" {
var error1 = "Please enter your name";
var error2 = "Please enter your street address";
var error3 = "Please enter your postcode";
var error4 = "Please enter your town";
var error5 = "Please enter your State / County:";
var error6 = "Please enter your NIF";
var error7 = "You must provide either a telephone number or an email address";
var error8 = "Your email address is invalid";
var error9 = "Please choose your membership type";
} else {
var error1 = "ES Please enter your name";
var error2 = "ES Please enter your street address";
var error3 = "ES Please enter your postcode";
var error4 = "ES Please enter your town";
var error5 = "ES Please enter your State / County:";
var error6 = "ES Please enter your NIF";
var error7 = "ES You must provide either a telephone number or an email address";
var error8 = "ES Your email address is invalid";
var error9 = "ES Please choose your membership type";
}
if(document.application.name.value == "" {
alert(error1);
document.application.name.select();
return false;
}
if(document.forms.application.direccion.value == "" {
alert(error2);
document.application.direccion.select();
return false;
}
if(document.application.codigo_postal.value == "" {
alert(error3);
document.application.codigo_postal.select();
return false;
}
if(document.application.poblacion.value == "" {
alert(error4);
document.application.poblacion.select();
return false;
}
if(document.application.provincia.value == "" {
alert(error5);
document.application.provincia.select();
return false;
}
if ((lang != "en" && (document.application.nif.value == "") {
alert(error6);
document.application.nif.select();
return false;
}
//MAKING EITHER TELEPHONE OR EMAIL MANDATORY
if ((document.application.telefono.value == "" && (document.application.email.value == "") {
alert (error7);
document.application.telefono.select();
return false;
}
//BUT, IF AN EMAIL ADDRESS IS ENTERED IT SHOULD BE CHECKED
if ((document.application.email.value != "" && (document.application.email.value.indexOf ('@',0) == -1 || document.application.email.value.indexOf ('.',0) == -1)) {
alert (error8);
document.application.email.select();
document.application.email.select();
return false;
}
//WHY DOESN'T THIS WORK?
if ((document.application.cuota[0].checked == false)
&& (document.application.cuota[1].checked == false)
&& (document.application.cuota[2].checked == false)
&& (document.application.cuota[3].checked == false)) {
alert (error9);
return false;
}
}
// -->