Page 1 of 1

communication between DSPF and IFrame DSPF

Posted: Thu Jan 17, 2019 5:28 am
by DavidBal
Hi,

I created a DSPF with a Tab Panel(main DSPF). Every Tab has its own IFrame(child DSPF).
If I click on a button(Speichern) in my main DSPF I am able to change a input field in my child DSPF's. That works.
start_save.PNG
start_save.PNG (466.08 KiB) Viewed 709 times
Buttons onclick:

var iframe = document.getElementById("IFrame1");
var innerDoc = iframe.children[0].contentDocument || iframe.children[0].contentWindow.document;

var box = innerDoc.getElementById("TXTSPEICHE");
parent.changeElementValue(box,'1');


My question is how can I detect the changes I made with JavaScript to the field in my child DSPF's?
Onchange or Oninput in the input field does not work. I need to place a pui.click().
I attached the main(zztst1fm) and a child(zztestdba) DSPF.

Hope you can help me!

Thanks

David

Re: communication between DSPF and IFrame DSPF

Posted: Thu Jan 17, 2019 9:26 pm
by Kaylee Law
Hello David,

Thank you for writing in.

It looks like you are trying to execute a pui.click() on the display file located inside of the iFrame (zztestdba) is this correct?

If so you can simply call the pui.click() from the button located on your main display file (zztst1fm) by adding the following line at the end of your button's onclick event:
var iframe = document.getElementById("IFrame1");
var innerDoc = iframe.children[0].contentDocument || iframe.children[0].contentWindow.document;

var box = innerDoc.getElementById("TXTSPEICHE");
parent.changeElementValue(box,'1');

getObj('IFrame1').childNodes[0].contentWindow.pui.click()
This code will select the PUI object located inside of the iFrame and run it's version of pui.click().

Could you try this code and see if it accomplishes what you are looking for?

Re: communication between DSPF and IFrame DSPF

Posted: Fri Jan 18, 2019 2:58 am
by DavidBal
Hi Kyle,

great to see that only one line of code is needed to get my expected result. :)
Works great. Many thanks!

David