Ver Mensaje Individual
  #15 (permalink)  
Antiguo 07/10/2010, 07:46
harryems
 
Fecha de Ingreso: septiembre-2010
Mensajes: 113
Antigüedad: 13 años, 8 meses
Puntos: 4
Respuesta: Zend select's dependientes

la verdad es que ya tengo pena de preguntar, pero mi desesperacion pudo mas que el orgullo, y al parecer que el buen investigador :(

tengo mi script
Código PHP:
function cargaContenido()
{
    var 
opcionSeleccionada=$("#razonSocial").val();
    var 
idSelectDestino='Empresas';
    var 
selectDestino=document.getElementById(idSelectDestino);
    var 
datastring'opcionSeleccionada='+opcionSeleccionada;
             $.
ajax(  
                     {  
                         
asynctrue,  
                         
type'GET',  
                         
url'http://localhost/sicat2/site/ajax',  
                         
datadatastring,
                         
dataTypeString'text',
                         
beforeSend: function(data){
                                   $(
'#selectDestino').html('<label>Cargando...</label>');
                                     
selectDestino.disabled=true;
                         },  
                         
success: function(requestData){  
                                    
                         },  
                         
error: function(requestDatastrErrorstrTipoError){  
                             
                         },  
                         
complete: function(requestDataexito){
                             
selectDestino.disabled=false;
                         }  
                     });  
    


la funcion de mi controlador
Código PHP:
    function ajaxAction()
    {
        
$this->_helper->viewRenderer->setNoRender();
        
$this->_helper->layout->disableLayout();
        if (!
$this->getRequest()->isXmlHttpRequest())
        {
            
$this->_redirect('site/detgaratias');
        }
            
$datos = new DatosBase();
            
$razon_social $this->_getParam('opcionSeleccionada');
            
$selectHtml '<select id="Empresas">';
            
$empresas_list $datos->getEmpresasList($razon_social);
            foreach(
$empresas_list as $key=>$value)
            {
                    
$selectHtml .= "<option value=\"$key\">$value</option>";
            }
            
$selectHtml .= '</select>';
            echo 
$selectHtml;
     
    } 
y mi clase modelo

Código PHP:
    function getEmpresasList($razonsocial)
    {
        print(
$razonsocial);
        
$this->_db3 Zend_Registry::get('db3');
        
$select  $this->_db3->select()
                            ->
from($this->_empresa,
                            array(
'key' => 'id_uname','value' => 'nombre'))
                            ->
where('id_razon_social = ?',$razonsocial)
        
$result $this->_db3->fetchPairs($select);
        return 
$result;
    } 
pero no puedo hacer llegar mi variable a la accion del controlador.

espero puedan ayudarme.

gracias.