Comunidad de diseño web y desarrollo en internet online

Como llenar un comboBox

Citar            
MensajeEscrito el 24 Feb 2006 01:02 am
Hola ;
Por favor;
¿Cómo lleno un comboBox desde mysql con AMFPHP,de tal manera que la "etiqueta" sea : "facultad" ; y el valor o data sea: "codf" si tengo lo sgte en mi servicio:..?

Código :

...function CBFacultades(){         
 $sql = "SELECT codf,facultad FROM facultades"; 
               return $this->query($sql,0);  
         }...   


tengo éste script pero sencillamente no funciona:

Código :

import mx.remoting.NetServices;
import mx.remoting.Connection;
mx.remoting.debug.NetDebug.initialize();
                                 
NetServices.setDefaultGatewayUrl("http://www.midominio.com/amfphp/gateway.php"); 
conexion = NetServices.createGatewayConnection();

capturaRespuesta = new Object();
servicio = conexion.getService("Sistema",capturaRespuesta);

capturaRespuesta.onStatus = function (data){
   trace("ERROR por:" +data.description);
}
capturaRespuesta.CBFacultades_Result = function (data){
   
   if (data){ //si la consulta fue correcta 
      if (data.getLength()){ //si tengo al menos un registro
         for (i=0; i<data.getLength();i++){ //codificacion de datos
            ComboBox.addItem({etiqueta:data.getItemAt(i).codf, valor:data.getItemAt(i).facultad });

   }
servicio.CBFacultades();

Gracias por sus respuestas...

Por juce2005

100 de clabLevel



 

msie
Citar            
MensajeEscrito el 24 Feb 2006 02:01 am
usa

Código :

SELECT codf AS data, facultad AS label FROM facultades;



y en tu funcion de resultado

Código :

capturaRespuesta.CBFacultades_Result = function (data) {
 tucombobox.dataProvider = data._items
}


me parece que es asi...el truco es a la hora de generar la consulta sql

Por tangamampilia

.GAIA Developer

961 de clabLevel


6 articulos

Genero:Masculino   Anime Bloggers

México, D.F.

safari
Citar            
MensajeEscrito el 24 Feb 2006 02:51 pm
ok. voy a probar.., muchas gracias por tus prontas respuestas "tangamampilia".

Por juce2005

100 de clabLevel



 

msie

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.