Ho un formail in actionscrip collegato a un mailform.php per l'invio di dati e, nel form iniziale, erano previsti 3 campi obbligatori:
fname, lname, email. Io devo aggiungere come obbligatori anche telno e comments... ho scasinato un pò e ora se lascio il formail in bianco mi dice anche in quei campi che dovevano essere compilati, ma se compilo i primi 3 campi e faccio invia manda il messaggio senza ritornare l'errore...

qualcuno mi da una mano?

il codice associato è questo :



fscommand ("allowscale", "false");
fname1.tabIndex = 1;
lname1.tabIndex = 2;
email1.tabIndex = 3;
telno1.tabIndex = 4;
comments1.tabIndex = 5;
mailform = "mailform.php";
confirm = "please wait for confirmation ..."
action = "send";
Selection.setFocus("fname");
function validate (address) {
if (address.length>=7) {
if (address.indexOf("@")>0) {
if ((address.indexOf("@")+2)<address.lastIndexOf(".") ) {
if (address.lastIndexOf(".")<(address.length-2)) {
return (true);
}
}
}
}
return (false);
}
function formcheck () {
if ((((email == null)) || (email.length<1)) || (email == "ERROR! Address not valid")) {
email = "ERROR! Address not valid";
action = "";
}
if (!validate(email)) {
email = "Address not valid";
action = "";
}
if ((((fname == null)) || (fname.length<1)) || (fname == "ERROR! Address not valid")) {
fname = "Name required";
action = "";
}
if ((((lname == null)) || (lname.length<1)) || (lname == "ERROR! Address not valid")) {
lname = "Name required";
action = "";
}

if ((((telno == null)) || (telno.length<1)) || (telno == "ERROR! Address not valid")) {
telno = "Name required";
action = "";
}
if ((((comments == null)) || (comments.length<1)) || (comments == "ERROR! Address not valid")) {
comments = "Name required";
action = "";
}

if ((validate(email)) && (email != "ERROR!") && (fname != "") && (lname != "") && (telno != "") && (comments != "")) {
action = "send";
loadVariablesNum (mailform, 0, "POST");
gotoAndPlay ("wait");
}
}
stop ();