Domino Code Fragment

Code Name*
Validation fields onSubmit
Date*
07/10/2000
Source (or email address if you prefer)*
roccorocco@telepolis.com
IP address:.195.76.19.42
Description*
Validar campos cuando guardamos un Formulario
Type*
Formula, JavaScript
Categories*
User Interface (Web)
Implementation:
None (plug and play)
Required Client:
(none)
Server:
(none)
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
En el Botón que utilizamos para guardar(save) ponemos
@If (
@Command ([FileSave]);
@Command ([FileCloseWindow]);
NULL
)


En el evento onSubmit del formulario ponemos el siguiente código

var f = document.forms[0]
if (f.Nombre.value == "") {
alert ("Introduzca el Nombre.");
f.Nombre.focus();
return false;
}
if (f.Apellido.value == "") {
alert ("Introduzca el 1er Apellido.");
f.Apellido.focus();
return false;
}
if (f.Apellido2.value == "") {
alert ("Introduzca el 2º Apellido.");
f.Apellido2.focus();
return false;
}
if (f.NColegiado.value == "") {
alert ("Introduzca el Nº de Colegiado.");
f.NColegiado.focus();
return false;
}

//para campos radion button
rb = false; //asumimos que no hay ningun valor señalado
for (i = 0; i < f.Pedir_Certificado.length; i ++) {
if (f.Pedir_Certificado[i].checked) {
rb = true;
}
}
if (rb == false) {
alert ("Seleccione Si o No");
f.Pedir_Certificado[0].focus();
return false;
}