Ver Mensaje Individual
  #2 (permalink)  
Antiguo 09/05/2006, 11:57
augusto_jaramil
 
Fecha de Ingreso: junio-2004
Ubicación: Ciudad de Panama
Mensajes: 551
Antigüedad: 19 años, 10 meses
Puntos: 8
Que tal amigos.....

Tengo casi resueltas mis dudas.

[cita]
2. Como puedo lograr que recupere varios registros segun la consulta a la Base de Datos, es decir, en mi sql le pongo Limit 5 por ejemplo. Entonces mi pregunta es, Que debo modificar en el script anterior para que recupere los 5 registros que me retornara la consulta. He intentado colocar los input dentro de un ciclo for de php, pero no tengo ni idea de por que no me detecta este codigo, aparecen en la forma lo sigiente:

Nit :"; for ($j=0; $j<6; $j++) { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } ?>

[/cita]

el script lo tenia con extension .htm, entonces lo renombre con extension .php y listo

Eso fue todo... PERO ME TIRE COMO TRES DIAS PARA LLEGAR A ESTO haciendo pruebas y repruebas, cambiando esto por lo otro.... etc.

El script quedo asi:

Código PHP:
>
    /************************************************************************************************************
    (C) www.dhtmlgoodies.com, November 2005
    
    This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.    
    
    Terms of use:
    You are free to use this script as long as the copyright message is kept intact. However, you may not
    redistribute, sell or repost it without our permission.
    
    Thank you!
    
    www.dhtmlgoodies.com
    Alf Magne Kalleland
    
    ************************************************************************************************************/    
    var ajax = new sack();
    var currentClientID=false;
    var currentNombreID=false;
        var ind = false;

    function getClientData(i)
    {
                var i = document.getElementById("ind").value;
        var clientId = document.getElementById("nit"+i).value.replace(/[^0-9]/g,'');
        var nombreId = false;
        if(clientId.length > 0 && clientId!=currentClientID) {
            currentClientID = clientId;
            ajax.requestFile = 'consul.php?accion=xnit&getClientId='+clientId;
        }

                ajax.onCompletion = function () {alert(ajax.response);}
                ajax.onCompletion = function () {showClientData();}
        ajax.runAJAX();
    }
    
    function getClientDataXNombre(i)
    {
                var i = document.getElementById("ind").value;
        var nombreId = document.getElementById("nombre"+i).value;
        var clienteId = false;
        
        if(nombreId.length > 0 && nombreId!=currentNombreID) {
            currentNombreID = nombreId;
            ajax.requestFile = 'consul.php?accion=xnombre&getNombreId='+nombreId;
        }
        
                //ajax.onCompletion = function () {alert(ajax.response);}
                ajax.onCompletion = function () {showClientData();}
        ajax.runAJAX();
    }

    function showClientData()
    {
        var formObj = document.forms['clientForm'];
        eval(ajax.response);
    }

    function initFormEvents()
    {
        var formObj = "";
                var i = document.getElementById("ind").value;
        document.getElementById('nit'+i).onblur = getClientData;
        document.getElementById('nombre'+i).onblur = getClientDataXNombre;
        document.getElementById('nit'+i).focus();
    }
    
    window.onload = initFormEvents;

    </script>
</head>

<body>
<table>
    <form name="clientForm" action="consul.php" method="post">
        <table align="center">
            <tr>
            <table>
            <td>Nit</td><td>Nombre</td><td>Direccion</td><td>Telefono</td><tr>
<?php
            
for ($i=0$i<10$i++) {
                echo 
"<td><input type='hidden' name='ind' id='ind' value='$i'>";
                echo 
"<input name='nit$i' id='nit$i'></td>";
                echo 
"<td><input name='nombre$i' id='nombre$i'></td>";
                echo 
"<td><input name='direccion$i' id='direccion$i'></td>";
                echo 
"<td><input name='telefono$i' id='telefono$i'></td><tr>";
            }
?>
            <tr>
            <td colspan="4" align="center"><input type="reset"></td></tr>
            </table>
        </table>    
    </form>
</table>
</body>
</html>
Como dicen por ahi... LA CONSTANCIA VENCE LO QUE LA DICHA.....

Pero me queda otro lio
Si quiero modificar digamos el contenido de la columna nombre del tercer registro.... ahi si perdi el año por que no detecta ningun cambio en dicha columna, ni en ninguna otra que este despues de la primera fila...

Si algun alma caritativa me puede ayudar.... lo agradeceria infinitamente

Un Cordial Saludo