Update widget from annother one

Hallo,

i have to widgets,
one is autorefreshing the other not.
One is a grid, showing a picture, the other is a control, which should only refresh the grid, when the active picture was changed in the DB.
What i tried is:

?>
<!doctype html public “-//w3c//dtd html 4.0 transitional//en”>
<html>
<head>
<meta http-equiv=“Content-Type” content=“text/html; charset=UTF8”>
<script type=“text/javascript”>
function reload_frame_12()
{
var frame_id = “id-iframe-widget12”;
parent.document.getElementById(frame_id).contentWindow.location.reload(true);
}

</script>
</head>
</html
<?php

reload_frame_12();

the widget id is correct, but it`s not working.
Any ideas ?

ok, i figured it out
the call
reload_frame_12() is javascript and does not work under php
in the script i had to do a window.onload = reload_iframe_12
instead

I’ve had several problems with getelementById in JavaScript, try the same but with GetElementsByName

Regards

After a long night and a couple of beer i figured it out:

the start of the script has to be in the script section:
window.onload = reload_frame_12;
and the element has to be:
window.parent.document.getElementById(frame_id).contentDocument.location.reload(true);

1 Like