Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by zxo102 on Jul 01, 2008 01:58
open dhtmlx forum
How to load html content from database returned by CGI?

Hi,
I have a web application. The main html page has two frames: frameA and frameB. After a user clicks a link (javascript) in frameA,the result (a html page) from CGI searching a database returns back to frameB.
Now I put "dhtmlXTabBar" into frameB and would like to put the result from my CGI:" /bop-cgi/xbop?..." into the tab. I have tried two ways as attached. But no luck. All failed. Thanks for your help.



The first way returns the error message:
"Error type: LoadXML Description: Incorrect XML".
I am not sure what is wrong with the XML (sorry I don't use XML very much).
////////////////////////////////////
var xmlstr1 = '<?xml version="1.0"?><tabbar hrefmode="iframe"><row> <tab id="b2" width="100px" href="/bop-cgi/xbop?requestIds=[system.mUsers.dboUsers.search]&system.mUsers.dboUsers.searchString=username=\'manager\'&system.mUsers.dboUsers.searchLength=5&responseId=system/application/username.html&SID=\'0x11ADD22ADD9L\'" >Google 2groups</tab></row></tabbar>'

tabbar=new dhtmlXTabBar("a_tabbar","top");
tabbar.setImagePath("/xbop/jslib_wh/codebase/imgs/");
     // tabbar.loadXML("/xbop/wisco/tabs5.xml");
tabbar.loadXMLString(xmlstr1);
tabbar.setSkinColors("white","#FFFACD");
////////////////////////////////////

I also tried it in the other way, it works but the result page is sent to a pop-up page instead of the tab page.
The response page was sent to window.frames['frameB'].location. Again, how to send the response page into the tab (id = 'b3')?

The javascript code is as follows:

<script>

function my_func(idn,ido){
if (idn=="b3"){
    //handleRequestTarget2('[]','wisco/mDrop_menu/stuff_insert.html', document.forms[0], target='frameB');
    handleRequestTarget2('[]','wisco/mDrop_menu/stuff_insert.html', document.forms[0], target='b3');
    }
    return true
};

tabbar=new dhtmlXTabBar("a_tabbar","top");
tabbar.setImagePath("/xbop/jslib_wh/codebase/imgs/");
tabbar.setSkinColors("#FCFBFC","#F4F3EE","#FCFBFC");
tabbar.setOnSelectHandler(my_func);
tabbar.loadXML("/xbop/wisco/tabs5.xml");
</script>

tabs4.xml:
------------------------------------------------
<?xml version="1.0"?>
<tabbar hrefmode="iframe">
<row>
<tab id="b1" width='100px' selected="1" href="http://groups.google.com">Google 1groups</tab>
    <tab id="b3" width='100px'> xxxxx </tab>
</row>
</tabbar>
-----------------------------------------------------


ouyang
Answer posted by Support on Jul 01, 2008 03:51
>>I am not sure what is wrong with the XML (sorry I don't use XML very much).
The problem is in & chars inside url, they must be replaced with &amp; to be processed correctly

>>The javascript code is as follows:
By default the iframe created by tabbar is nameless , you can get iframe window object by tabbar.tabWindow(id)

tabbar.loadXML("/xbop/wisco/tabs5.xml",function(){
    tabbar.tabWindow('b3').name="b3"; //set name for window object, so it may be used for navigation
});