Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by ni on Jan 21, 2009 04:09
open dhtmlx forum
Combobox getElementById

Hello.
I am making a form using Combobox.

I would like to know how I could clear out input from a part of a form.

I've put a function called ClearField(); , and tried to use getElementById.


<div id="personnelid" class= "personnelid" ></div>
<input type="button" value="Clear this field" onClick="clearField();">

<script type="text/javascript">
    function clearField()
    {
    var elm1 = document.getElementById('personnelid');
    elm1.value = "";    
    }
    </script>


<script type="text/javascript">        
var internaldepid = "", machineid = "", trainingmodulegroupid = "", refcode = "", trainingcourseid = "", personnelname = "";
//Personnel name
            var p=new dhtmlXCombo("personnelid","personnelid",300);         
            p.loadXML("autosuggestxmllist.php?op=personnelnamexml", true, true);
     p._def_path="autosuggestxmllist.php?op=personnelnamexml";
    p.enableFilteringMode(true, "autosuggestxmllist.php?op=personnelnamexml&mask=TEXT", true, true);                             
                            
//Personnel area        
            var a=new dhtmlXCombo("personnelareacon","personnelareaid",300);         
            a.loadXML("autosuggestxmllist.php?op=personnelareaxml", true, true);         
     a._def_path="autosuggestxmllist.php?op=personnelareaxml";
    a.enableFilteringMode(true, "autosuggestxmllist.php?op=personnelareaxml&mask=TEXT", true, true);     
</script>            
Answer posted by Support on Jan 21, 2009 06:45
with above code, you can use 
  function clearField() 
  { 
            p.setComboText("")
            a.setComboText("")
   }