Foros del Web » Programando para Internet » PHP »

Donde esta el error?

Estas en el tema de Donde esta el error? en el foro de PHP en Foros del Web. hola tengo un formulario q ingresa registros a una BD acabo de hacerle la validacion de campos y el error q sale es q si ...
  #1 (permalink)  
Antiguo 06/07/2006, 18:45
 
Fecha de Ingreso: noviembre-2004
Mensajes: 496
Antigüedad: 19 años, 5 meses
Puntos: 0
Exclamación Donde esta el error?

hola tengo un formulario q ingresa registros a una BD acabo de hacerle la validacion de campos
y el error q sale es q si no lleno un campo me sale la ventanita de advertencia "el campo es obligatorio" y al poner aceptar manda campo igual es decir lo manda vacio
<script language="javascript">
function validar()
{
patron=/^[0-9]*$/;
if (document.form1.banco.value == "") {
alert ("EL CAMPO BANCO ES OBLIGATORIO DEBE INGRESAR SU CLAVE PERSONAL");
document.form1.banco.focus();return;
}
if (document.form1.operacion.value == "") {
alert ("EL CAMPO OPERACION ES OBLIGATORIO DEBE INGRESAR EL SUYO");
document.form1.operacion.focus();return;
}
if (form1.nombre_re.value == "") {
alert ("EL CAMPO NOMBRE ES OBLIGATORIO DEBE INGRESAR EL SUYO");
document.form1.nombre_re.focus();return;
}
if (document.form1.apellidos_re.value == "") {
alert ("EL CAMPO APELLIDOS ES OBLIGATORIO DEBE INGRESAR SU EDAD ");
document.form1.form1.apellidos_re.focus();return;
}
if(isNaN(parseInt(document.form1.monto.value)) || patron.test(document.form1.monto.value)==0){
alert('EL CAMPO MONTO SOLO ACEPTA NUMEROS');
document.form1.monto.focus();return;
}
if(isNaN(parseInt(document.form1.telefono_re.value )) || patron.test(document.form1.telefono_re.value)==0){
alert('EL CAMPO TELEFONO SOLO ACEPTA NUMEROS');
document.form1.telefono_re.focus();return;
}
if (form1.mail_re.value == "") {
alert ("EL CAMPO MAIL ES OBLIGATORIO DEBE INGRESAR SU PAIS DE ORIGEN");
document.form1.mail_re.focus();return;
}
if (document.form1.mensaje_re.value == "") {
alert ("EL CAMPO MENSAJE ES OBLIGATORIO DEBE INGRESAR SU CIUDAD DE ORIGEN");
document.form1.mensaje_re.focus();return;
}
if (document.form1.nombre_be.value == "") {
alert ("EL CAMPO NOMBRE ES OBLIGATORIO DEBE INGRESAR SU CIUDAD DE ORIGEN");
document.form1.nombre_be.focus();return;
}
if (document.form1.apellido_be.value == "") {
alert ("EL CAMPO APELLIDOS ES OBLIGATORIO DEBE INGRESAR SU CIUDAD DE ORIGEN");
document.form1.apellido_be.focus();return;
}
if (document.form1.mail_be.value == "") {
alert ("EL CAMPO MAIL ES OBLIGATORIO DEBE INGRESAR ");
document.form1.mail_be.focus();return;
}
if (document.form1.direccion_be.value == "") {
alert ("EL CAMPO DIRECCION ES OBLIGATORIO DEBE INGRESAR ");
document.form1.direccion_be.focus();return;
}
if(isNaN(parseInt(document.form1.telefono_be.value )) || patron.test(document.form1.telefono_be.value)==0){
alert('EL CAMPO TELEFONO SOLO ACEPTA NUMEROS');
document.form1.telefono_be.focus();return;
}
document.form1.submit();
}
</script>
hay alguna forma de q salga solo la ventana de advertencia sin el boton de aceptar


este es el codigo del boton enviar
<td><input name="button" type="submit" class="Estilo3" onClick="validar()" value="Continuar"/></td>
  #2 (permalink)  
Antiguo 06/07/2006, 19:47
 
Fecha de Ingreso: julio-2005
Ubicación: Buenos Aires, Argentina
Mensajes: 1.304
Antigüedad: 18 años, 9 meses
Puntos: 6
Uno de los errores es que esto no es php, sino javascript... y hay un subforo para eso que no es este

Y el otro error que te aqueja, me parece que es éste:

<input name="button" type="submit" class="Estilo3" onClick="validar()" value="Continuar"/>


Se me hace que debería ser asi:

<input name="button" type="button" class="Estilo3" onClick="validar()" value="Continuar"/>


Suerte!
__________________
Federico.

Mi página: www.jourmoly.com.ar
  #3 (permalink)  
Antiguo 06/07/2006, 19:58
 
Fecha de Ingreso: noviembre-2004
Mensajes: 496
Antigüedad: 19 años, 5 meses
Puntos: 0
gracias federico tienes toda la razón
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 20:45.