Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Madhu on May 20, 2009 06:07
open dhtmlx forum
Disabling an option when using dhtmlxcombo

How can we disable an option when we use a dhtmlx combo box like we disable an option in a select box using html <select disable='disabled'> tag.
Answer posted by Alex (support) on May 20, 2009 07:00
Hello,
try to use
combo.disable(true);

Answer posted by Madhu on May 20, 2009 07:24
Hi,

I think that will disable the combo box... but i want to disable a particular option only...is there any solution
Answer posted by Support on May 20, 2009 08:46
What do you mean by disabling?
Visual styles of option can be affected as 
   combo.getOption(value).render().style.color="gray"; 
so it will look as disabled, but there is no option to prevent its selection. 

You can add logic to onChange event of combo as

combo.attachEvent("onChange",function(value){
   if (some_check(value))
        combo.setComboValue(""); //switch to empty value
})

Answer posted by Madhu on May 20, 2009 22:50
Hi,

Disabling an option means the way we disable it in the following manner like for example,

<select name="mySelectBox">
      <option value="1">One</option>
      <option value="2" disabled="disabled">Two</option>
      <option value="3">Three</option>
</select>

Here we can disable a particular option and we can prevent the user from selecting the option which is disabled.
In the same above manner, I want to disable an option when using the dhtmlXcombo. Is this possible using the dhtmlXcombo box!
Answer posted by Support on May 21, 2009 01:50
>>Disabling an option means the way we disable it in the following manner like for example,
Such use-case not supported by dhtmlxcombo