Welcome Guest, Not a member yet? Register   Sign In
Combobox chained problem IE
#1

[eluser]tnathos[/eluser]
Hi i have a combobox in a age and works fine in firefox.. but i dont understand for what dont works in IE.. any can help me!!?

thansk.. the code..

in the view
Code:
<select name="categoria" id="categoria" class="inputsbox">
            
             &lt;?php foreach($categorias->result() as $row):
            
                //echo '<option value=' .  $row->id . ' ></option>';
                
                echo '<option value=' .  $row->id . '>' .  $row->nombre_es .'</option>';
            
            endforeach; ?&gt;    
            
             </select>
            </td>
            <td>
            <select name="sub_categoria" id="sub_categoria" class="inputsbox" >
          
             </select>

in the javascript..
Code:
function call_subcategoria(id_categoria) {
    
    document.getElementById("sub_categoria")[removed] = '<option>Cargando...</option>';

     $.ajax({
         type: "POST",
         url: "http://localhost:8888/xxxxx/publicar/get_subcategoria/",
         data: 'categoria='+id_categoria,
         success: function(response){
         document.getElementById("sub_categoria")[removed] = response;      
        }
     });

}
#2

[eluser]kgill[/eluser]
For future reference if you ask questions involving browser problems you need to also identify what browser version you're referring to, IE6, IE7 and IE8 all have very different issues when it comes to javascript. It also looks like you're using jQuery (you should also mention that) so I'm going to base my answer off that.

If I had to guess I'd say it's your document.getElementById that's screwing things up. Why aren't you using jQuery's selectors to get and set data instead?
#3

[eluser]tnathos[/eluser]
i use IE8 but whit mode compatbility in the page IE7... but later for try to resolve y find the solution.. its what the response ajax print all combox and not only the items.. and works..
#4

[eluser]danmontgomery[/eluser]
Why are you using document.getElementById with jquery? The entire purpose of jquery is to simplify javascript calls like getElementById

Code:
$("#sub_categoria")

What is [removed]? What isn't working? What response are you getting from the ajax call?
#5

[eluser]Peng Kong[/eluser]
Code:
echo '<option value=' .  $row->id . '>' .  $row->nombre_es .'</option>';

also you're missing quotes... which maybe cause cross-browser issues.

is should be...

Code:
echo '<option value="' .  $row->id . '">' .  $row->nombre_es .'</option>';
#6

[eluser]tnathos[/eluser]
ooooo thanks




Theme © iAndrew 2016 - Forum software by © MyBB