Incorrect combo value when selected item contains HTML.

I am using dhtmlxCombo according to the rules at … index.html .

I’m using the XML below. According to the docs I can use HTML in the option (and it shows correctly) but when an option is selected, the hidden input field doesn’t get the correct value (numeric) but the plain text (i.e. I get ‘WARNING’ instead of ‘4’).


	<option value="0"><![CDATA[<span class="loglevel0">EMERG</span>]]></option>
	<option value="1"><![CDATA[<span class="loglevel1">ALERT</span>]]></option>
	<option value="2"><![CDATA[<span class="loglevel2">CRIT</span>]]></option>
	<option value="3"><![CDATA[<span class="loglevel3">ERR</span>]]></option>
	<option value="4"><![CDATA[<span class="loglevel4">WARNING</span>]]></option>
	<option value="5"><![CDATA[<span class="loglevel5">NOTICE</span>]]></option>
	<option value="6"><![CDATA[<span class="loglevel6">INFO</span>]]></option>
	<option value="7"><![CDATA[<span class="loglevel7">DEBUG</span>]]></option>
	<option value="8"><![CDATA[<span class="loglevel8">NONE</span>]]></option>


We have not reproduced the problem. How was the option selected ?

We select the option with a mouse click. At that time, the DOM is correct (note the values of hidden fields):

<input readonly="readonly" style="width: 365px;" class="dhx_combo_input" autocomplete="off" type="text"> <input name="filter.minSeverity" type="hidden" value="3"> <input name="filter.minSeverity_new_value" type="hidden" value="false">

When the focus moves to other component (or when confirmValue is called), the DOM changes to:

<input readonly="readonly" style="width: 365px;" class="dhx_combo_input" autocomplete="off" type="text"> <input name="filter.minSeverity" type="hidden" value="ERR"> <input name="filter.minSeverity_new_value" type="hidden" value="true">

Seems like the control is thinking that the ‘ERR’ value is not part of the option list and sends it as if it was a new value.

I hope this helps. Let me know if you need more information. We are using DHTMLX 3.0.

Can the problem be reproduced in the dhtmlxCombo/samples/02_actions/03_combo_save.html sample from combo package ( … _save.html) ? What should we do to reproduce it ?

Thanks a lot for your assistance Alexandra.

While preparing the reproduction case I found that the problem was caused by newlines within the CDATA section. This was the XML that I was using:

<complete> <option value="-1">This works (no markup no newlines)</option> <option value="0"><![CDATA[<span class="loglevel0">EMERG</span> ]]></option> <option value="1"><![CDATA[<span class="loglevel1">ALERT</span> ]]></option> </complete>

As you can see there are newline characters within option values, but I miserably reformatted the XML before posting it in my previous post. Shame on me.

Oddly enough, however, the value is correctly assigned when the option is initially clicked. Only when the focus is lost the value is incorrectly re-assigned. Perhaps DHTMLX could improve this or show an alert when options contain newline characters.

In any case, sorry for the inconvenience.

Thank you and regards!