RE: [PHP-ES] O.T.: Problemas con Javascript y AJAX.
| From: | Esteban Osorio | Date: | Wed, 05 Apr 2006 15:46:10 +0000 |
| Subject: | RE: [PHP-ES] O.T.: Problemas con Javascript y AJAX. | ||
| Groups: | php.general.es | ||
| Request: | Send a blank email to general-es+get-58471@lists.php.net to get a copy of this message | ||
Voy a intentar con el evento onBlur porque probé con las sugerencias
anteriores y no funciona...
-----Original Message-----
From: XIMvad [mailto:ximvad@gmail.com]
Sent: Miércoles, 05 de Abril de 2006 11:17
To: php-es@lists.php.net
Subject: Re: [PHP-ES] O.T.: Problemas con Javascript y AJAX.
yo por lo general lo trabajo de esta forma y me funciona:
function grabar()
{
valida = validar();
if (valida)
{
existeRut();
document.getElementById('ingresar').value = 'true';
//window.document.consulta.submit();
return(true);
}
return(false);
}
y en el HTML
[...]
<form name="form1" onSubmit="grabar()">
[...]
saludos
XIMvad
Esteban Osorio escribió:
> Ok, este es el código...
>
> function grabar()
> {
> valida = validar();
> if (valida)
> {
> existeRut();
> document.getElementById('ingresar').value = 'true';
> window.document.consulta.submit();
> }
> return;
> }
>
> function existeRut()
> {
> var rut, resultExist;
> rut = document.getElementById('rut').value +
> document.getElementById('digver').value;
> ajax = nuevoAjax();
> ajax.open("GET", "procesos2.php?rut="+rut, true);
> ajax.onreadystatechange=function() {
> if (ajax.readyState == 4) {
> resultExist = ajax.responseText;
> if(resultExist!="N") {
>
> document.getElementById('id_usuario').value = resultExist;
> if(confirm("¡El RUT ingresado se ha
> registrado anteriormente en el sistema!.\n\n Haga clic en ACEPTAR para
> modificar los datos o CANCELAR para mantener los anteriores."))
>
> {
>
> document.getElementById('modificado').value = 'true';
>
> document.getElementById('buscado').value = 'true';
> } else {
>
> document.getElementById('mantenerDatos').value = 'true';
> }
> return;
> }
> }
> }
> ajax.send(null);
> return;
> }
>
> -----Original Message-----
> From: pvergara@tqr.biz [mailto:pvergara@tqr.biz]
> Sent: Miércoles, 05 de Abril de 2006 10:30
> To: php-es@lists.php.net
> Subject: Re: [PHP-ES] O.T.: Problemas con Javascript y AJAX.
>
>
> El Miércoles, 5 de Abril de 2006 16:21, Esteban Osorio escribió:
> > Hola lista,
> >
> > Sigo con mis problemas al ejecutar un ajax.
> >
> > Tengo un código javascript que ejecuta una función que realiza un
> ajax para
> > validar un valor usando una función php, el llamado a la función se
> realiza
> > justo antes de llamar al método submit del formulario en cuestión. El
> > problema está en que al parecer antes de completar el ajax se realiza
el
> > submit por lo que no se alcanza a realizar la comprobación del valor.
> > ¿Alguna idea sobre como resolver esto?.
> >
> >
> >
> >
> > Saludos,
> > Esteban Osorio F.
>
> Necesitaría ver un código de ejemplo, puesto que, aunque sé a que te
> refieres,
> quizás el fallo sea que realmente si se está realizando la validación,
pero
> aun así también se está realizando el submit.
>
> Saludos.
>
> --
> ----
> Pablo C. Vergara Castro.
> Departamento de informática.
> TQR-Software
> Tlfno.: (+34) 986 39 31 49
> Fax: (+34) 986 31 25 96
>
>
> La información transmitida va dirigida únicamente a la persona o entidad
> que se muestra como destinatario y puede contener datos confidenciales o
> privilegiados. Toda revisión, retransmisión, diseminación u otro uso o
> acción al respecto por parte de personas o entidades distintas al
> destinatario está prohibida. Si recibe esto por error, por favor
> contacte con la persona que figura como remitente y elimine el material
> de cualquier ordenador.
>
>
> The information transmitted is intended only for the person or entity to
> which it is addressed and may contain confidential and/or privileged
> material. Any review, retransmission, dissemination or other use of, or
> taking of any action in reliance upon, this information by persons or
> entities other than the intended recipient is prohibited. If you
> received this in error, please contact the sender and delete the
> material from any Computer.
>
> --
> PHP Spanish Localization Talk Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> ------------------------------------------------------------------------
>
> ###########################################
> Este mensaje ha sido revisado por el scanner antivirus del Ministerio de
Economia.
--
PHP Spanish Localization Talk Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php