Dependent dropdown after loading of DIV

1

I have in the file Fields.php the code below, which selects the company and according to the request will load divs with fields specific to that request. At the first request, I have to load Headquarters and it is loaded according to the selected company code (TT or PA). If the selected companion is TT the data of menu dropdown must be 2998 w 2378 if it must be PA 9867 and 5678, that data is saved in a table. The problem is that since% with fields are only loaded after the choice of request, either% of%,% of% or% with% of Company's value is not pulled. Just to make it clear that DIV I have 99% of the cases we get here but generally the JavaScript/JQuery "son" and "father" are within the same VBScript . Any idea? There are things that are $_POST and standardized, I need to leave script in different files and dropdown are like that too.

$sql = "SELECT CONCAT(Company,' - ',Nome) AS Valor, CONCAT(Company,' - ',Nome) AS Texto FROM Company WHERE Pais LIKE '$pais' AND (Company LIKE 'TT%' OR Company LIKE 'PA%') ORDER BY Valor";
new SelectField("company","Company","",260,"onChange=LoadPlant()",$idioma,"line","","mandatory;",$sql,"DB_".$dbPath."Company","show");



$sql = "SELECT Codigo AS Valor, Opcao AS Texto FROM Solicitacao WHERE Pais LIKE '$pais' ORDER BY Valor";
new SelectField("solicitacao","Tipo da Solicitação","",260,"onChange=Solicitcao_OnChange()",$idioma,"line","","mandatory;",$sql,"DB_".$dbPath."Company","show");

$idSolicitacao = "01"; 
echo "<div id=$idSolicitacao>";

$sql = "SELECT Opcao AS Valor, Opcao AS Texto FROM plant_material WHERE Market = 'xxx'";
new SelectField($idSolicitacao."plant","Plant (Material/Destination)","",260,"",$idioma,"line","","mandatory;",$sql,"DB_".$dbPath."Forms_96","show");     


echo "</div>";

In another file the div has

$company = utf8_decode($_POST["company"]);

$sql = "SELECT Opcao FROM plant_material WHERE Market = '$company' ORDER BY Opcao";
$query = mysql_query($sql);

echo "<option value=''>-</option>";    
while($rs = mysql_fetch_assoc($query))
{
    echo "<option value='$rs[Opcao]'>".htmlentities("$rs[Opcao]")."</option>";
}  

And in the file Framework I have

//<<<<< LoadPlant() >>>>>
function LoadPlant()
{   
    var company = $("#company").val();
    var idSolicitacao = $("#Solicitacao").val();

    $.post(
        "Scripts/LoadPlant.php",
        {company:company},
        function(valor)
        {                   
            $("select[name=plant]").html(valor);    
        }
    );
}
    
asked by anonymous 06.12.2016 / 14:05

0 answers