Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Stephen on May 12, 2009 01:40
open dhtmlx forum
dhtmlxLayout attachURL - how to pass parameters back and forth

Take layout pattern 2U.
What is the recommended way of passing parameters from
1) a to b and back
2) b to a?

From (a) I want to attach a php form in (b)
And I want to pass parameters from (a) to (b) for use in the form (as display text and as default input values).

What is the recommended way of passing parameters a -> b?
From (a)
1) attachURL using URL with GET method to pass parameters or
2) or use :
var frame = layout.cells("b")._frame;
frame.contentWindow.document.getElementById("myId").innerHTML=myparameter;
(This does not seem to work immediately after attachURL - maybe browser has not completed loading?)

What is the recommended way of passing parameters b -> a?
I think this must be a function call: eg parent.func(params..) ?
Answer posted by Alex (support) on May 12, 2009 02:18

Hello, 

>>This does not seem to work immediately after attachURL - maybe browser has not completed loading?)

You can set onload event handler in the page loaded inside "b":

<body onload="parent.doOnBLoaded()">

 In this case doOnBLoaded() function is defined in the page with layout

function doOnBLoaded(){var frame = layout.cells("b")._frame; ... }

>>What is the recommended way of passing parameters b -> a?I think this must be a function call: eg parent.func(params..) ?

Yes, you can try to use parent.func(params..) 

Answer posted by Stephen on May 12, 2009 03:26
Using <body onload="parent.doOnBLoaded()">  does not work for me as I will have lost the data I wanted to pass across when doing the attachURL.

Answer posted by Stephen on May 12, 2009 03:58
I think using GET in attachURL('someurl?param1=x') will have to do the job.
Need to amend the form to cater for this submit.

Answer posted by Alex (support) on May 12, 2009 06:52

Yes, you can use the get request to pass the parameters.

As another solution for getElementById("myId") you can use onContentLoaded event.  The sample is http://dhtmlx.com/docs/products/dhtmlxWindows/samples/events/url.html?un=1242134190000