Triple Dynamic Combo

1

Good afternoon,

Next, I'm doing a dynamic combo with three selects where I have offensive area, status, and substatus. I pull the offending area and it pulls the cute status. This script was an adaptation of one I found in google, so I wanted to deploy a third select but as not javascript handle I'm caught here.

The index part without php looks like this:

            <html>
            <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
            <script src="jquery-1.7.2.min.js" type="text/javascript"></script>
            <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script><scripttype="text/javascript"> 


            //funcao para carregamento do status de acordo com area ofensora - Combo dinamico

            function buscar_status(){
                  var AreaOfensora = $('#AreaOfensora').val();
                  if(AreaOfensora){
                    var url = 'ajax_buscar_status.php?AreaOfensora='+AreaOfensora;
                    $.get(url, function(dataReturn) {
                      $('#load_status').html(dataReturn);
                    });
                  }
                }

            //funcao para carregamento do substatus de acordo com status e area ofensora - Combo dinamico

            function buscar_sub(){
                  var AreaOfensora = $('#AreaOfensora').val();
                  var status = $('#status').val();
                  if(status){
                    var url = 'ajax_buscar_substatus.php?AreaOfensora='+AreaOfensora+'&status='+status;
                    $.get(url, function(dataReturn) {
                      $('#load_substatus').html(dataReturn);
                    });
                  }
                }

            </script>
            </head>
            <body>
            <form method="POST" action="envia.php"> 

                        <p><div class="div3"><label>Área ofensora:</label><br>
                            <select name="AreaOfensora" id="AreaOfensora" onblur="ValidaEntrada(this,'combo');" class="txt2comboboxpadrao bradius" onchange="buscar_status()">
                                    <option value="">Selecione...</option>
                                        <?php foreach ($arrAreaOfensora as $value => $name) 
                                        {
                                            echo "<option value='{$value}'>{$name}</option>";
                                        }
                                        ?>
                                </select></p></div>


                        <p><div class="div3"><div id="load_status"><label>Status</label><br>
                            <select name="status" id="status" onblur="ValidaEntrada(this,'combo');" class="txt2comboboxpadrao bradius" onchange="buscar_sub()">
                                <option value="">Selecione o status</option>
                            </select>
                        </p></div></div>


                        <p><div class="div3"><div id="load_substatus"><label>Substatus</label><br>
                            <select name="substatus" id="substatus" onblur="ValidaEntrada(this,'combo');" class="txt2comboboxpadrao bradius">
                                <option value="">Selecione o substatus</option>
                            </select>
                        </p></div></div>


                        <input type="submit" value="Cadastrar" id="cadastrar" name="cadastrar">

            </form>         

            </body>
            </html>         

The page that I call to fetch the data in the database to fill the select is working correctly in both functions, because I tested sending the data manually by the url and rolled legal, but when I change the status it does not call the third select function: When I call the two functions on the first select (for testing) it changes the two combos, but I need the status to have the substatus.

Can anyone help me ?? Please!! Please please Thank you so much!

    
asked by anonymous 09.05.2016 / 17:19

0 answers