function checkrequired(formulario) { //if (document.images) { for (i=0;i 0) { if (((tempobj.type=="text")||(tempobj.type=="textarea")||(tempobj.type=="password")||(tempobj.type=="file"))&&(valor.length==0)&&(nombre_campo.length >0)){ alert("Por favor, introduzca el campo "+nombre_campo+"."); tempobj.focus(); return false; } if ((tipo.length > 0)&&(valor.length > 0)) { switch (tipo){ case "num": if (isNaN(valor)) { alert("El campo: "+nombre_campo+" debe ser numérico"); tempobj.select(); return false; } break; case "dts": if (!validar_fecha(tempobj.name)) { tempobj.select(); return false; } break; case "@@@": var inicio = valor.indexOf("@"); var fin = valor.lastIndexOf("@"); if ((inicio != fin) || ((inicio == -1) && (fin == -1)) || ((inicio == 0) && (fin == 0))|| ((inicio == valor.length-1) && (fin == valor.length-1))){ alert("Por favot revise el campo "+nombre_campo+", no contiene una dirección correo electrónico."); tempobj.select(); return false; } break; case "hhh": var horas=valor.split(":")[0]; var minutos=valor.split(":")[1]; var segundos=valor.split(":")[2]; if (valor.indexOf("/")==-1) { alert("La hora indicada no tiene el formato correcto: hh:mm o hh:mm:ss"); return false; } if ((horas > "23")||(horas < "0")) { alert("La parte horaria de la hora es incorrecta.\nLas parte horaria va desde 0 a 23."); tempobj.select(); return false; } if ((minutos > "59")||(minutos < "0")) { alert("Los minutos de la hora son incorrectos."); tempobj.select(); return false; } if ((segundos > "59")||(segundos < "0")) { alert("La segundos de la hora son incorrectos."); tempobj.select(); return false; } break; case "txt": break; //campos de texto //nada case "bit": break; //campos tipo bit //nada case "ids": break; //campos de identificadores //nada } } } } //} //fin document.images return true; } var a, mes, dia, anyo, febrero; function anyoBisiesto(anyo){ if (anyo < 100) var fin = anyo + 1900; else var fin = anyo ; if (fin % 4 != 0) return false; else { if (fin % 100 == 0) { if (fin % 400 == 0) return true; else return false; } else return true; } } function validar_fecha(nm_campo_) { var a = eval("document.forms[0]."+nm_campo_+".value"); if (a.indexOf("/")==-1) { alert("La fecha indicada no tiene el formato correcto: dd/mm/aaaa"); return false; } dia=a.split("/")[0]; mes=a.split("/")[1]; anyo=a.split("/")[2]; if(anyoBisiesto(anyo)) febrero=29; else febrero=28; if ((mes<1) || (mes>12)) { alert("El mes introducido no es valido. Por favor, introduzca un mes correcto"); return false; } if ((mes==2) && ((dia<1) || (dia>febrero))) { alert("El dia introducido no es valido. Por favor, introduzca un dia correcto"); return false; } if (((mes==1) || (mes==3) || (mes==5) || (mes==7) || (mes==8) || (mes==10) || (mes==12)) && ((dia<1) || (dia>31))) { alert("El dia introducido no es valido. Por favor, introduzca un dia correcto"); return false; } if (((mes==4) || (mes==6) || (mes==9) || (mes==11)) && ((dia<1) || (dia>30))) { alert("El dia introducido no es valido. Por favor, introduzca un dia correcto"); return false; } if ((anyo<1900) || (anyo>3000)) { alert("El año introducido no es valido."); return false; } return true; } //---------------------- frances ----------------------------------- function checkrequired_fr(formulario) { //if (document.images) { for (i=0;i 0) { if (((tempobj.type=="text")||(tempobj.type=="textarea")||(tempobj.type=="password")||(tempobj.type=="file"))&&(valor.length==0)&&(nombre_campo.length >0)){ alert("Merci de bien vouloir indiquer votre "+nombre_campo+"."); tempobj.focus(); return false; } if ((tipo.length > 0)&&(valor.length > 0)) { switch (tipo){ case "num": if (isNaN(valor)) { alert("Field: "+nombre_campo+" must be numeric."); tempobj.select(); return false; } break; case "dts": if (!validar_fecha(tempobj.name)) { tempobj.select(); return false; } break; case "@@@": var inicio = valor.indexOf("@"); var fin = valor.lastIndexOf("@"); if ((inicio != fin) || ((inicio == -1) && (fin == -1)) || ((inicio == 0) && (fin == 0))|| ((inicio == valor.length-1) && (fin == valor.length-1))){ alert("Merci de bien vouloir indiquer votre "+nombre_campo+"."); tempobj.select(); return false; } break; case "hhh": var horas=valor.split(":")[0]; var minutos=valor.split(":")[1]; var segundos=valor.split(":")[2]; if (valor.indexOf("/")==-1) { alert("Time is not in the correct form: hh:mm o hh:mm:ss"); return false; } if ((horas > "23")||(horas < "0")) { alert("Hours in time is not valid.\nHours from 0 to 23."); tempobj.select(); return false; } if ((minutos > "59")||(minutos < "0")) { alert("Minutes in time are not correct."); tempobj.select(); return false; } if ((segundos > "59")||(segundos < "0")) { alert("Seconds in time are not correct."); tempobj.select(); return false; } break; case "txt": break; //campos de texto //nada case "bit": break; //campos tipo bit //nada case "ids": break; //campos de identificadores //nada } } } } //} //fin document.images return true; } var a, mes, dia, anyo, febrero; function anyoBisiesto(anyo){ if (anyo < 100) var fin = anyo + 1900; else var fin = anyo ; if (fin % 4 != 0) return false; else { if (fin % 100 == 0) { if (fin % 400 == 0) return true; else return false; } else return true; } } function validar_fecha(nm_campo_) { var a = eval("document.forms[0]."+nm_campo_+".value"); if (a.indexOf("/")==-1) { alert("Date is not in a valid format: dd/mm/aaaa"); return false; } dia=a.split("/")[0]; mes=a.split("/")[1]; anyo=a.split("/")[2]; if(anyoBisiesto(anyo)) febrero=29; else febrero=28; if ((mes<1) || (mes>12)) { alert("Month introduced is not valid. Please, put a correct month"); return false; } if ((mes==2) && ((dia<1) || (dia>febrero))) { alert("Day introduced is not valid. Please, put a correct day"); return false; } if (((mes==1) || (mes==3) || (mes==5) || (mes==7) || (mes==8) || (mes==10) || (mes==12)) && ((dia<1) || (dia>31))) { alert("Day introduced is not valid. Please, put a correct day"); return false; } if (((mes==4) || (mes==6) || (mes==9) || (mes==11)) && ((dia<1) || (dia>30))) { alert("Day introduced is not valid. Please, put a correct day"); return false; } if ((anyo<1900) || (anyo>3000)) { alert("Introduced year is not valid."); return false; } return true; }