4.0.2 comobox.load issue

I am trying to upgrade from 3.6 to 4.0.2 and getting error:

Uncaught TypeError: Cannot read property ‘getElementsByTagName’ of null. Below is an image of the error in chrome debugger. The error is because the parameter E is null.

This error only occurs when calling combobox.load(‘url’).
Here is my code

comboTranTree = new dhtmlXCombo("TranTree", "tranTree1", 150);
comboTranTree.load("pagevrd.vrd?session=9zbr0zvt51rj9pqj26uzdad6gidy0adw&page=glreport&reportCode=TTEXP&formAction=getData&reportDate=31/03/2014&accountFilter=&excludeZero=false&tCode=&tranTree1=&reportBudget=&publishedReportOid=&combo=tranTree1");

The xml returned from my url looks like this:

Contract Salesperson Site TT multi level

When using v3.6 with the old loadXML method, the above code works perfectly.

Is there something I am missing or is this a bug within 4.0.2?

Any help will be greatly appreciated.
Thanks


Locally everything correct.
Could you provide a direct link or completed demo to test it?
docs.dhtmlx.com/doku.php?id=othe … leted_demo

Hi
Thanks for the help.

The link is: link to PRO version was saved and deleted

Click on “Click here for a Demo Login”.
Click on “e-Computers - NZ”
Click on Show Menu(Top Left), General Ledger, Financial Reports, Management Reports,Tran Tree Expenses.
On this page there is 3 comboboxes, the first one (“All Levels”) is using dhtmlXComboFromSelect which is working fine. The second one calling the code below, which is causing the error.

comboTranTree = new dhtmlXCombo("TranTree", "tranTree1", 150);
comboTranTree.load("pagevrd.vrd?session=ff0agk3o9ta96mceqbxm327d68vaxaio&page=glreport&reportCode=TTEXP&formAction=getData&reportDate=31/03/2014&accountFilter=&excludeZero=false&tCode=&tranTree1=&reportBudget=&publishedReportOid=&combo=tranTree1",function(){
				// callback
			});

The link in the load method can be pasted into the url and will give you the xml.
link to PRO version was saved and deleted
Thanks


Hi

have you checked response?


Strange, I am getting xml string back. But why would the same code work ok with version 3.6 with only changing load to loadXML?

could you please take only 1 combo, take xml for it, create completed demo where it will not work as on your site and send us this demo to support@dhtmlx.com?

Hi
I think I found the issue. With version 3.6 loadXML is doing a GET where load in 4.0.2 is doing a POST. Check images below

How would I change it to do a GET instead of a POST?




I solved it.
I had to add

window.dhx4.ajax.method = "get"; 

before the load so it will do a GET instead of a POST.
Looks like the previous versions always did a GET but with 4 it is not the case.

Hi,

This solution doesn’t work for me.
I have just d/l the std 4.3 and have updated my sources to comply with this version (mostly removing obsolete functions and changes in loading).

Whatever I do I keep getting this error.
Which worked fine with version 3.5

XML is the same, headers are ok, all the tags are there.

Menu’s and XML-files still work but getting the XML from the server gives this error.
If I look at the dhtmlx-code it seems it can’t find the ‘complete’ tag, which is definitely there !

Any ideas where to look ?

rg,rg

Hi, richardg
Please send us completed demo on support@dhtmlx.com with a link to this topic. We will inspect it locally
docs.dhtmlx.com/auxiliary_docs__ … pport.html

Hi Darya,

A complete example would be difficult since there are a lot of components involved.
This is a full-blown application and it worked with 3.5…

I’m currently looking into the headers again.
What I’ve tried now (and is working) is to do a ajax.get and pass the responseText to the load function of the comboBox.
Note the Text part because it looks like the combo.load doesn’t get the data in the responseXML part of the reply !

PHP generates the data and it’s definitely setting the header and the xml-tag in the data.

So either I’m missing something obvious or somehow the data is not parsed into the ReponseXML.

I’ll keep you posted !

rg,rg

Well, now I found it ultra-fast :-/

For others having similar problems :
The “fault” was in the php header command.

This is what worked with 3.5 :

header(“Content-type: text/xml”);

This is what it has to be in 4.3 :

header(“Content-Type: text/xml”);

The difference is that it needs to be a capitol T !
This may be something to allow in dhtmlx : accept any way of writing of the header.
Examples on the internet wrt content-type use different casing :

  • content-type
  • Content-type
  • Content-Type
    is all the same, but not for dhtmlx !

Thanx for responding, if I got it all working we’ll upgrade to the Pro version (again) !

rg,rg

You are welcome! :slight_smile:
Current version is better than old one, plus there are some new components :slight_smile: