Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Andrea Benini on Dec 11, 2009 00:44
open dhtmlx forum
DHTMLXCombo Error when using Internet Explorer

I'd like to report you a small bug when using DHTMLXCombo
I've always used Firefox and Opera, no issues about them, a colleague of mine reported problems with MS Explorer (strange, isn't it ? :-) ).
let's take a short example:

Create a combo using a "standard" HTML combo syntax like:
<select id=mycombo name="Record[mycombo]">
<option value="123" selected>123</option>
</select>

And use this JS code to create an object:
window.dhx_globalImgPath = "combo/";
var mycombo = new dhtmlXComboFromSelect("mycombo","Record[mycombo]");
mycombo.loadXML("xml.dataload.php?value=123");
mycombo.enableFilteringMode(true, "xml.dataload.php", false);
mycombo.setOptionWidth(600);

Code is fine and working with FF and Opera, when using Explorer you got an error on dhtmlxcombo.js (line 61 in "encoded" js page), the first error is in this statement:
z.style.width = width+"px";
you must change the statement to:
z.width = width+"px";
if you want to be compliant with Explorer

This is NOT the only error, this is just the first one reported by error Explorer console

If you create the JS object with:
var mycombo = new dhtmlXCombo("mycombo","Record[mycombo]", 300);
instead of: var mycombo = new dhtmlXComboFromSelect("mycombo","Record[mycombo]");

Everything works fine, obviously you need to change the HTML code by replacing <SELECT></SELECT> with:
<div id="mycombo" name="Record[mycombo]"></div>

I don't like explorer and its behaviour but when you're creating a portal for foreign users you need to face its "standard capabilities"
Hope it helps you to fix the bug

Cheers

Andrea (Ben) Benini
Answer posted by Alex(support) on Dec 11, 2009 02:15

Hello,

the second parameter of the dhtmlXComboFromSelect method is combo width. Name is got from select tag. The sample is attached

Attachments (1)
sample.zip21.40 Kb