in reply to Re^4: send windowmessage from cgi back to form that called the cgi
in thread send windowmessage from cgi back to form that called the cgi

I still think you do want to do things onload to get your alert box, but i did go to your page and now understand better what you want.

ok for starters add this above "function onMessage(event)"

function showTable(loc) { document.getElementById("tableId").innerHTML="Waiting on:" + loc; document.getElementById("dataDialog").src = loc; }
then under
<iframe id="dataDialog" name="dataDialog" style="float:right"; src=""; + border:1px solid black;" scrolling="no" allowtransparency="true" all +owfullscreen="false" frameborder="no" width="200" height="400" > </iframe>
add
<div id="tableId" style="background-color:lightgray"></div>
now change
<input type="button" class="jalaLtSans" value="Member Table Data Updat +e" style="background-color:#0D4A80; width : 250px; color:#fff" onClic +k = "self.location='https://www.jala-mi.org/httpsdocs/cgi-bin/update_ +tables-development.cgi?action=updatetable_3'"/>
to
<input type="button" class="jalaLtSans" value="Member Table Data Updat +e" style="background-color:#0D4A80; width : 250px; color:#fff" onClic +k = "showTable('https://www.jala-mi.org/httpsdocs/cgi-bin/update_tabl +es-development.cgi?action=updatetable_3')"/>
.location and .src may do the same, my code uses .src

Now try pressing the "Member Table Data Update" button, is that better?

now if you still want the "Get File Load Status" button change its code to

<input type="button" class="jalaLtSans" value="Get File Load Status" s +tyle="background-color:#0D4A80; width : 250px; color:#fff" onClick = +"showTable('https://www.jala-mi.org/httpsdocs/cgi-bin/update_tables-d +evelopment.cgi?action=updatereport')"/>
How is that? aww but you want to get rid of the "waiting on" junk now dont ya? Well that is part of the side effect of my iframeLoad call from the cgi. so change your cgi-bins that use this technique to look something like
print $q->header( -type =>'text/html'); print <<"EODEOD"; <title>mytitle</title> <script language="JavaScript"> <!-- function iframeLoad(a) { a = document.getElementById("tableId").innerHTML; parent.document.getElementById("tableId").innerHTML = a; parent.document.getElementById("dataDialog").src = "about:blank"; }//--> </script> <body onload="iframeLoad()"> <div id="tableId"> EODEOD ...... print '</div>';

After running this a bit you may understand why my code has style="visibility:hidden;display:none" for hiframe

now as an exercise for the reader, imagine that showTable instead looked like this

function showTable(loc,table) { document.getElementById(table).innerHTML="Waiting on:" + loc; document.getElementById("dataDialog").src = loc; }
and the onClicks were suitably modified to contain the proper ids, say table1,table2,table3 and these were spread out in your code
<div id="tableid1" style="background-color:lightgray"></div> <div id="tableid2" style="background-color:lightgray"></div> <div id="tableid3" style="background-color:lightgray"></div>
and each different cgi-bin program used its own tableid instead of the generic TableId i showed. cute huh? I just showed you stuff from the simpler page so you wouldnt get too confused. One side effect i havent corrected for is that only one "button" can be in progress at a time, i never put a locking protocol in place, i just dont press another button till the last has finished

And yet i still tend to deny knowing any javascript,and Noscript blocks most pages i visit. I also deny knowing any cobol, c, or assembler too cuz last time i admitted to knowing cobol they made me program in it. and made me read other peoples dumps, Dont know TPF either

BTW: Doesnt routine that send back html to the iframe? should have been "Doesnt the routine send back html to the iframe?" Aparently not, it just replaced the main page it seems.

and Gad it takes me time to work out the bugs in this stuff.
"what do you mean ME kemosabe"

https://www.youtube.com/watch?v=oWuMevc6G4w edit: i like this one better https://www.youtube.com/watch?v=e1TmhBJxO70

Replies are listed 'Best First'.
Re^6: send windowmessage from cgi back to form that called the cgi
by tultalk (Monk) on Mar 15, 2017 at 12:51 UTC

    Ok. "and Gad it takes me time to work out the bugs in this stuff. "what do you mean ME kemosabe" "

    Us for a lesser portion. My problems have been massive.

    You say: "I still think you do want to do things onload to get your alert box"

    I still don't understand what you are implying.

    There is nothing to call to be put in the iframe on the parent page onload event. The database queries have not been run at that point so no results.

    Obvious thanks to you guys.

    Your comment "ok for starters add this above "function onMessage"

    There is no message event because I can't figure out how to send a message back to the form from perl.

    So I don't understand what you are trying to demonstrate. The calls through cgi to update the tables and return data sets work fine.

    They are all disabled so the calls will only return message with out actual execution of the database queries.

    As I started out, my fundamental problem is sending a wm to the form triggering a call to get the result message and show it in the iframe as demonstrated by clicking the test button.

    I hate things like polling but I can see no other way than starting a polling loop checking the value of a global variable set in the script when the original function call to do the database stuff finishes.

    When the variable (flag) is set the polling picks it up and calls the function to load the results into the iframe.

    I have looked at various "watch" examples that don't work and others that use a listener but all seem invoving sending a message to the window.

    Also looked at module for embedding javascript into perl but gave up.

    Simple polling loop started when original cgi command sent to script seems the way to go.

    I don't understand this statement: Aparently not, it just replaced the main page it seems.

    Are you saying that when you tested it live it just replaced the page with a new page and not put the result in the iframe

      My problems have been massive

      blame the person that wrote the original code. i could have rewritten the entire thing from scratch in the time i have spent trying to teach you what you have done wrong

      There is nothing to call to be put in the iframe on the parent page onload event. The database queries have not been run at that point so no results.

      I am not talking about a parent onload event, i am talking about a iframe onload event

      Your comment "ok for starters add this above "function onMessage. There is no message event because I can't figure out how to send a message back to the form from perl. "

      i went to your page, looked at the source, and there is a "function onMessage" in it

      So I don't understand what you are trying to demonstrate. The calls through cgi to update the tables and return data sets work fine.

      If the calls were working fine you wouldnt be here asking the question, the cgi works fine maybe but the call is not working fine as it replaces the parent html

      As I started out, my fundamental problem is sending a wm to the form triggering a call to get the result message and show it in the iframe as demonstrated by clicking the test button.

      As i pointed out the root of your fundamental problem is that you are calling the cgi call in the parent and not the iframe. That is what the changes i suggested address

      I don't understand this statement: Aparently not, it just replaced the main page it seems.

      There is a lot you dont understand it seems. You seem to be trying to use magic spells that are above your level of understanding and you dont pay attention enough to even learn how to use them correctly. This code

      <input type="button" class="jalaLtSans" value="Member Table Data Updat +e" style="background-color:#0D4A80; width : 250px; color:#fff" onClic +k = "self.location='https://www.jala-mi.org/httpsdocs/cgi-bin/update_ +tables-development.cgi?action=updatetable_3'"/>
      calls the cgi in the parent. what you want to do is call it in the iframe. I showed you a way to do that, but you do not want to consider it, so it seems trying to help you anymore is just another lost cause. good luck

        Went back and reread your post. You know how to hurt a guy. Kick me when I am down. I hope you still have your stuff together when you are 77. Had not worked with perl since 2003-2005. A long time ago in a place far away.

        As a source of unlimited knowledge, I want to ask about access control. My origial program had owm access control stuff in it that intercepted a page request and checked login status before sending request on its way.

        I looked on cpan and there were all sorts of access control modules. Can you make suggestions?

        What I want is like the page identity I sent you to look at would have to go through access control and be blocked unless the user had logged in.

        Don't want to reinvent the wheel

        Don't let that door hit ya where God split ya.
          A reply falls below the community's threshold of quality. You may see it by logging in.