Ver Mensaje Individual
  #5 (permalink)  
Antiguo 13/02/2012, 09:47
juanjofabila
 
Fecha de Ingreso: enero-2012
Mensajes: 4
Antigüedad: 12 años, 3 meses
Puntos: 0
Respuesta: llenar input con ajax

Cita:
Iniciado por MARCASTELEON Ver Mensaje
Hola,

Si te puedo ayudar, para eso estamos, seria buenno que pongas el codigo de los text input y que me expliques mejor como es el sistema.
OK MUCHAS GRACIAS.

Tengo el siguiente codigo, cuando escribo en el text input "buscar_Articulo" realiza la funcion de autocomplete, que busca los datos en mi base de datos, lo que quiero es que en cuanto me cambie de text input (se me ocurre que en el evento onfocus se rellene el valor del precio en el campo precio_unitario).

Espero ser lo mas claro posible. y agradezco infinitamente la ayuda.

Código HTML:
Ver original
  1. <link type="text/css" rel="stylesheet" href="style/jquery-ui-1.8.17.custom.css" />
  2. <script type="text/javascript" src="scripts/script.js"></script>
  3. <script type="text/javascript" src="scripts/jquery-1.7.1.min.js"></script>
  4. <script type="text/javascript" src="scripts/jquery-ui-1.8.17.custom.js"></script>
  5. <script type="text/javascript" src="scripts/jquery.ui.autocomplete.js"></script>
  6.  
  7. <script type="text/javascript">
  8.     $(function(){
  9.         $('#buscar_Articulo').autocomplete({
  10.             source: 'ajax.php',        
  11.         });
  12.     });
  13.  
  14. <div>
  15.             <tr>
  16.                 <th>Artículo</th>
  17.                 <th>Cantidad</th>
  18.                 <th>Ancho</th>
  19.                 <th>Alto</th>
  20.                 <th>Cadena</th>
  21.                 <th>Control</th>
  22.                 <th>Precio Unit.</th>
  23.                 <th>Subtotal</th>
  24.             </tr>
  25.             <tr>
  26.                 <td><input type="text" id="buscar_Articulo" name="buscar_Articulo" size="30" /></td>
  27.                 <td><input type="text" id="cantidad" name="cantidad" size="4" /></td>
  28.                 <td><input type="text" id="ancho" name="ancho" size="4" /></td>
  29.                 <td><input type="text" id="alto" name="alto" size="4" /></td>
  30.                 <td><select name="cadena" id="cadena">
  31.                     <option>Plastico</option>
  32.                     <option>Metal</option>
  33.                 </select></td>
  34.                 <td><select name="control" id="control">
  35.                     <option>Izquierdo</option>
  36.                     <option>Derecho</option>
  37.                 </select></td>
  38.                 <td><input type="text" id="precio_unitario" name="precio_unitario" size="4" onfocus="" /></td>
  39.                 <td><input type="text" id="subtotal" name="subtotal" size="4" onfocus="" /></td>
  40.             </tr>    
  41.         </table>
  42. </div>