Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted on Dec 04, 2009 03:37
open dhtmlx forum
fetch multiple value of checkbox

ya this is working fine but i want to check the multiple checkbox then event must be fired as per below code

combo provides onCheck event. It occurs when option checkbox is clicked:

combo.attachEvent("onCheck",function(value,state){

alert(value);

return true

})

i am getting only one value of checkbox , i want muliple value of checkbox and after that i want to add the value with the sql query and fetch data from databse.



this is my html file





<script>



window.dhx_globalImgPath = "http://localhost/seema/combo_test/codebase/imgs/combo_select.gif";



</script>

<link rel="STYLESHEET" type="text/css" href="codebase/dhtmlxcombo.css">

<script src="codebase/dhtmlxcommon.js"></script>

<script src="codebase/dhtmlxcombo.js"></script>

<script src="codebase/ext/dhtmlxcombo_extra.js"></script>








<h3>Checkbox Select</h3>

<div id="combo_zone2" style="width:200px; height:30px;"></div>



<script>



var z = new dhtmlXCombo("combo_zone2", "alfa2", 200, 'checkbox');

z.loadXML("common/test.php");



z.attachEvent("onCheck",function(value,state){

alert(value);

return true

})


</script>






<?php

    header("Content-type:text/xml");

    ini_set('max_execution_time', 7000);

    require_once('config.php');



    print("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>");

?>

<?php

    $link = mysql_pconnect($mysql_host, $mysql_user, $mysql_pasw);

    $db = mysql_select_db ($mysql_db);



    if (!isset($_GET["pos"])) $_GET["pos"]=0;



    



    //print one level of the tree, based on parent_id

    //function getDataFromDB($mask){

        $sql = "SELECT DISTINCT item_nm FROM countries";

//    echo "ppp".    $sql.= " Order By item_nm LIMIT ". $_GET["pos"].",100";



        

            print("<complete>");

            $res = mysql_query ($sql);

        if($res){

            while($row=mysql_fetch_array($res)){

                print("<option value=\"".$row["item_nm"]."\">");

                print($row["item_nm"]);

                print("</option>");

            }

        }else{

            echo mysql_errno().": ".mysql_error()." at ".__LINE__." line in ".__FILE__." file<br>";

        }

        print("</complete>");

    //}

?>

plaese reply me as soon as possible.

Answer posted by Alex (support) on Dec 04, 2009 05:19

The getChecked method returns an array with values of checked options.

var checked_arr = combo.getChecked();