Problem with required form fields

Hi all :slight_smile:
Trying to use a form with required fields…
seems the code is not working right for me…the form will send the info anyway even if some fields are left blank…if the user types his email address and message text the form will send the info anyway…reporting in the field left blank the error message as it would have been typed by the user…
email received look like this:

Nome: Insert your name
Indirizzo: Insert your address
CittĂ : Insert your city
Email: [U][COLOR=#0000ff][EMAIL=“hello@hotmail.com”]hello@[/COLOR][/U]hotmail.com[/EMAIL]
Telefono: Insert your phone

Thought this could have do the job but it doesn’t: :h:

if ((validate(email)) && (email != “ERROR!”) && (fname != “”) && (lname != “”) && (citta1 != “”) && (telno1 != “”) && (mess1 != “”)) {

This is the complete action code i’m tryin to use…I want the fname, lname, citta, and telno to be required otherwise the form won’t send any info

can you please help me understand where’s my mistake?
thank you

fscommand(“allowscale”, “false”);
fname1.tabIndex = 1;
lname1.tabIndex = 2;
citta1.tabIndex = 3;
telno1.tabIndex = 4;
email1.tabIndex = 5;
mess1.tabIndex = 6;
mailform = “mailform_contatti.php”;
confirm = “invio delle informazioni in corso …”;
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 == “ERRORE! Indirizzo email inserito non valido!”)) {
email = “ERRORE! Indirizzo email inserito non valido!”;
action = “”;
}
if (!validate(email)) {
email = “email non valida”;
action = “”;
}
if ((((fname == null)) || (fname.length<1)) || (fname == “ERROR! Address not valid”)) {
fname = "Insert your name
= “”;
}
if ((((lname == null)) || (lname.length<1)) || (lname == “ERROR! Address not valid”)) {
lname = "Insert your address

}
if ((((citta == null)) || (citta.length<1)) || (lname == “ERROR! Address not valid”)) {
citta = "Insert your city
“”;
}
if ((((telno == null)) || (telno.length<1)) || (telno == “ERROR! Address not valid”)) {
telno = "Insert your phone

}
if ((validate(email)) && (email != "ERROR!") && (fname != "") && (lname != "") && (citta1  != "") && (telno1  != "") && (mess1  != "")) {
    action = "send";
    loadVariablesNum(mailform, 2, "POST");
    gotoAndPlay("wait");
}

}
stop();