Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Steven Lichtenberg on Apr 27, 2008 20:16
open dhtmlx forum
DhtmlXtree throws 'undefined' is null or not an object in IE7

In the following code, I am able to correctly render the tree using FireFox and everything work great. When I test it in IE 7, I get the 'undefined' is null or not an object error. This is frustrating me to no end. I have isolated the error to the line
var mytree = dhtmlXTreeFromHTML('treeboxbox_tree');

I haven't done more debugging than that yet though.

Anyone have a Q&D solution?

Thanks
--S
^


<div
id="treeboxbox_tree"
setImagePath="/images/imgs/"
enableCheckBoxes="true"
enableThreeStateCheckboxes="true"
enableDragandDrop="false"
style="width:350px; height:260px;overflow:auto;padding_left:70px;">

<ul>
<li id="canada" >Canada

<ul>
<script language="speedscript">

for each state where country = "canada" no-lock:
{&out} '<li id="' state.state '"'.
if hasbkcarr and index(bkcarr.state,state.state) <> 0
then {&out} 'checked="1"'.
{&out} '>' state.st-desc '</li>'.
end. /* for each state */

</script>
</ul>

</li>
<li>United States
<ul>
<script language=speedscript">

for each servicearea no-lock break by region by state:
if first-of(region) then {&out} '<li>' region '<ul>'.
{&out} '<li id="' state '"'.
if hasbkcarr and index(bkcarr.state,servicearea.state) <> 0
then {&out} 'checked="1"'.
{&out} '>' servicearea.state ' ' from_zip ' ' to_zip '</li>'.
if last-of(region) then {&out} '</ul></li>'.
end.

</script>
</ul>
</li>
<li id="mexico">Mexico </li>

</ul>
</div>

<script language="javascript">

var mytree = dhtmlXTreeFromHTML('treeboxbox_tree');

mytree.attachEvent("onCheck",onNodeSelect);

function onNodeSelect(nodeId){
document.servform.stateserv.value=mytree.getAllChecked();
alert(document.servform.stateserv.value);
}
Answer posted by Support on Apr 28, 2008 02:43
The case of attribute must be the same as in original command
    <div ... enableDragAndDrop="false"   
but this is minor issue , which must not cause js error.

Most pobably js error caused by the UL|LI structure. If there are some incorrectly placed UL or LI tags - the mentioned problem may occurs.
If error still occurs for you please exact HTML output of your script, because it is not really clear with current script code.