Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Rogério Luiz Sarmento on Apr 08, 2009 06:39
open dhtmlx forum
dhtmlxcombo group selected

Good morning,

I'm using dhmtlxcombo group and can not do the second combo select the item.

Please could you help me, excuse my English.

Thank you,

echo "<div style='position: absolute; top:368; left:5;'>";
echo "Especificação";
echo "</div>";

echo "<div id='combo2' style='position: absolute; top:368; left:140;'>";
echo "</div>";

echo "<script>";
echo "var z2=new dhtmlXCombo('combo2','txtequi',200);";
echo "z2.loadXML('getespe.php?selecao=$txtequi');";

echo "var z=new dhtmlXCombo('combo1','txtclas',200);";
echo "z.attachChildCombo(z2,'getesp.php');";
echo "z.loadXML('getclase.php?parent=$txtclas');";
echo "</script>";

getclasse.php

<?php

header("Content-type:text/xml");
print("<?xml version=\"1.0\"?>");

include_once "../config/config.php";
require("../".FUNCOES."conecta_postgres.php");

echo "<complete>";
$result = executa_sql("select rid,rdes from rclas order by rdes");
while ($line = linha_sql($result))
     {
if ($_GET["parent"] == $line[0])
echo '<option value="'.$line[0].'" selected="1">'.$line[1].'</option>';
else
echo '<option value="'.$line[0].'">'.$line[1].'</option>';
}
echo "</complete>";

?>

getespe.php

<?php

header("Content-type:text/xml");
print("<?xml version=\"1.0\"?>");

include_once "../config/config.php";
require("../".FUNCOES."conecta_postgres.php");

$xcod = $_GET["parent"];

echo "<complete>";
$result = executa_sql("select rid,rdes from requ,rces where requ.rid = rces.resp and rces.rclas = '$xcod' order by rdes");
while ($line = linha_sql($result))
     {
if ($_GET["selecao"] == $line[0])
echo '<option value="'.$line[0].'" selected="1">'.$line[1].'</option>';
else
echo '<option value="'.$line[0].'">'.$line[1].'</option>';
}
echo "</complete>";

?>
Answer posted by Alex (support) on Apr 08, 2009 07:04

Hello,

Please, check the server returns xml where some option contains "selected" attribute. 

Also we have attached the latest "groups" extension. There some issues were fixed. Please, try to use it.

If issue still persists, please provide the example of the xml which is returned from server for the second combo. 

Attachments (1)
Answer posted by Rogério on Apr 08, 2009 07:34
Alex

Thanks, solved the problem,