Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: send windowmessage from cgi back to form that called the cgi

by Corion (Patriarch)
on Mar 14, 2017 at 14:42 UTC ( [id://1184556]=note: print w/replies, xml ) Need Help??


in reply to send windowmessage from cgi back to form that called the cgi

Does your stuff happen in the client browser on the client machine or on the server machine?

If it happens in your client browser, you cannot do this with Perl.

  • Comment on Re: send windowmessage from cgi back to form that called the cgi

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

    That was quick.

    The "stuff" is generated by the script on the server (accessing MySQL). The script is called from the form where the results are loaded into the iFrame. I can get the results by the call to the CGI ...nt.cgi?action=updateReport. I want to do this automatically when the script producing the results finishes.

      This is more java JavaScript related than perl, but i have a page where i want to execute java JavaScript when it loads. based on what it does so you could try

      print $q->header( -type =>'text/html'); print <<"EODEOD"; <title>mytitle</title> <script language="JavaScript"> <!-- function iframeLoad(a) { window.parent.postMessage({ 'func': 'GetFileLoadStatus', 'message': 'Message text from iframe.' }, "*"); } //--> </script> <body onload="iframeLoad()"> EODEOD

      Edit: a was just a temp var, my sub was

      function iframeLoad(a) { a = document.getElementById("tableId").innerHTML; parent.document.getElementById("tableId").innerHTML = a; parent.document.getElementById("hiframe").src = "about:blank"; }
      In the parent i had
      ... function showTable(loc) { document.getElementById("tableId").innerHTML="Waiting on:" + loc; document.getElementById("hiframe").src = loc; } ... <input type="button" value="run program" onclick="showTable('/cgi-bin/ +program.pl?parm1=1')"> <iframe id="hiframe" src="about:blank" style="visibility:hidden;displa +y:none"></iframe> <div id="tableId" style="background-color:lightgray"></div> ....
      and the cgi call also returned
      .... <div id="tableId"> <pre> some stuff to display more stuff </pre></div>

        s/java/JavaScript/g

        Hi:

        Don't want to do anything on load.

        Go here http://www.jala-mi.org/httpsdocs/jala_AdminCore.htm

        at bottom are two buttons. Click Get File Load Status to load the iframe with the results (nothing because the part did not run that produces results). The other button clears the iframe.

        I want to execute these funtions from the cgi script on the server. The first one loading results when the actual process is complete and the clear function from the close button on the response form in the iframe.

        Again the perl code (more of it) updating tables disabled

        if ($action eq "updatetable_3") { # warn("Entered update_tables.cgi with action = UpdateTable_3"); # UpdateUserTable($dbh); # $message = "Update User Data Table"; # $filemessage = "User Data Table Update Complete"; } elsif ($action eq "updatetable_4") { # warn("Entered update_tables.cgi with action = UpdateTable_4"); # UpdateTenantTable($dbh); # $message = "Update Tenant Data Table"; # $filemessage = "Tenant Data Table Update Complete"; } elsif ($action eq "updatetable_5") { # warn("Entered update_tables.cgi with action = UpdateTable_5"); # UpdatePropertyTable($dbh); # $message = "Update Property Data Table"; # $filemessage = "Property Data Table Update Complete"; } elsif ($action eq "updatetable_6") { # warn("Entered update_tables.cgi with action = UpdateTable_6"); # DownloadUserTable($dbh); # $message = "Download User Data Table"; # $filemessage = "Download of File Completed: '$count'"; } else { # print p (escapeHTML ("Impossible Error: selected action is unknow +n: $action")); $message = "Database Failure"; $filemessage = "File Load Falure. Impossible Error: selected action +is unknown: $action"; } warn("Just before close connection"); manageusers::CloseConnection(); #window.parent.postMessage({ # 'func': 'GetFileLoadStatus', # 'message': 'Message text from iframe.' #}, "*"); if ($action eq "updatereport"){ warn("In updatereport before CreateFataFeedbackForm"); CreateDataFeedbackForm($message, $filemessage); }

        Enough of this. I will ser a global variable as a flag and "watch" it in javascript on the html page. When it changes I request the form to load into the iframe.

        Interesting read but I am not dealing with a log process and waiting. Just need to send a windowmessage from perl script to my form

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1184556]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-26 00:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found