ciao a tutti!non sono molto pratico di jsp ma comunque mi sono fatto una funzione che controlla se alcuni campi form di una pagina sono vuoti.
posto il codice:

codice:
<script language="javascript">
function control(fform) {
	Ctrl = fform.nome;
	if (Ctrl.value == "") {
	validatePrompt (Ctrl, "Attenzione ! Inserire il proprio nome \nPlease, play attention ! Insert your name");
	return false;
	}
	Ctrl = fform.cognome;
	if (Ctrl.value == "" )  {
	validatePrompt (Ctrl, "Attenzione ! Inserire il proprio cognome \nPlease, play attention ! Insert your surname");
	return false;
	}
	Ctrl = fform.indirizzo;
	if (Ctrl.value == "" )  {
	validatePrompt (Ctrl, "Attenzione ! Inserire il proprio indirizzo \nPlease, play attention ! Insert your address");
	return false;
	}
	Ctrl = fform.citta;
	if (Ctrl.value == "" )  {
	validatePrompt (Ctrl, "Attenzione ! Inserire la propria città \nPlease, play attention ! Insert the name of the town you live in");
	return false;
	}
	Ctrl = fform.telefono;
	if (Ctrl.value == "" )  {
	validatePrompt (Ctrl, "Attenzione ! Inserisci il tuo numero di telefono \nPlease, fill in your telephone number");
	return false;
	}
	if (isNaN(Ctrl.value))  {
    validatePrompt (Ctrl, "Attenzione ! Il campo 'telefono' supporta solo valori numerici \nPlease, only numbers are allowed");
	return false;
	}
	Ctrl = fform.cellulare;
	if (Ctrl.value == "" )  {
	validatePrompt (Ctrl, "Attenzione ! Inserisci il tuo numero di cellulare \nPlease, fill in your telephone number");
	return false;
	}
	if (isNaN(Ctrl.value))  {
    validatePrompt (Ctrl, "Attenzione ! Il campo 'cellulare' supporta solo valori numerici \nPlease, only numbers are allowed");
	return false;
	}
	Ctrl = fform.email;
	if (Ctrl.value == "" || Ctrl.value.indexOf ('@', 0) == -1 || Ctrl.value.indexOf('.') == -1 || (Ctrl.value.indexOf(' ') != -1))  {
    validatePrompt (Ctrl, "Attenzione ! Indirizzo e-mail non valido o assente \nPlease, play attention ! E-mail address incomplete or bad");
	return false;
    } 
    Ctrl = fform.professione;
	if (Ctrl.value == "" )  {
	validatePrompt (Ctrl, "Attenzione ! Inserire la propria professione \nPlease, play attention ! Insert your job");
	return false;
	}
}
function validatePrompt (Ctrl, PromptStr) {
	alert (PromptStr)
	return false;
}
// -->
</script>
funziona a meraviglia ed è molto pratico.
ora,oltre a controllare che il campo cellulare non sia vuoto,ho anche bisogno di controllarne la lunghezza.
voglio che se il dato inserito è < 7 mi compaia un altro alert con l'indicazione appropriata.
questo però,sinceramente,non ho idea di come poterlo fare.
qualcuno può darmi una mano.