Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

HTML refresh from CGI

by awkmonk (Monk)
on Mar 25, 2003 at 12:50 UTC ( #245667=perlquestion: print w/replies, xml ) Need Help??
awkmonk has asked for the wisdom of the Perl Monks concerning the following question:

I hope this is a nice easy one for my esteemed fellow monks.

A have a CGI script that uses frames and has a refresh button on one frame, and a timed refresh on the other frame. The plan is to have the first frame refresh the second (hide complete records, that sort of thing) as the second shows an on-going status.

My problem is that once I hit the refresh button on the first screen, I'm presented with one of Mr Gates's helpful windows informing me that to refresh the screen I must resend the data. This then pops up every 5 seconds thereafter.

I know that the parameter is being passed again, I just don't seem to be able to clear it/not send it. I've tried setting it to null but I can't modify an l-value, so how do I get rid of it?

env is MS Win2K, Perl 5.8 and Apache.


#!c:\perl\bin\perl -w BEGIN { $|=1; use CGI::Carp('fatalsToBrowser'); } use strict; use CGI qw(:standard); my $script = ""; my $cgi = new CGI; my $path_info = $cgi -> path_info; my $status = $cgi -> param("status"); print $cgi->header(); set_frame() if ! $path_info; top_frame() if $path_info =~ /Top/; bottom_frame() if $path_info =~ /Bottom/; sub set_frame { print frameset( {-rows => "33%,66%"}, frame({-name => "Top", -src => $script . "/Top"}), frame({-name => "Bottom", -src => $script . "/Bottom"}) ); } sub top_frame { print $cgi->start_html(); print $cgi->startform(-action=>"$script/Bottom",-TARGET=>"Bottom"); print '<b>Top Frame Text</b>'; print ' <input type="submit" value="Refresh" name="B_Refresh" '; print 'target="Bottom" >'; print '</form>'; print $cgi->end_html(); } sub bottom_frame { print $cgi->start_html(-head=>meta({-http_equiv => 'Refresh', -content => '5'})); print '<b>Bottom Frame Text</b>'; print $cgi->end_html(); }

P.S. I promise to buy myself a nice thick O'Reilly book on Perl & HTML, when I can afford it - roll on pay day.

Replies are listed 'Best First'.
Re: HTML refresh from CGI
by benn (Vicar) on Mar 25, 2003 at 14:11 UTC
    You could try making your form a GET instead of the default POST.
    $cgi->startform(-method=>'GET',-action=>"$script/Bottom",-TARGET=>"Bot +tom");
Re: HTML refresh from CGI
by cfreak (Chaplain) on Mar 25, 2003 at 14:19 UTC

    It sounds as though you created the frame in question with a POST request so all browsers would want to resend the data in order to create the same page.

    By looking at your code though I'm wondering if its your automatic refresh meta-tag that is causing the problem rather than the refresh button. I say that because the refresh button as it appears is really just a new form that sends new data, the browser shouldn't be looking at that as refreshing the page but as a completely new form. However the 'refresh' meta in your bottom frame probably is. If you are creating that bottom frame with a POST request it will keep doing that. The best solution I would think is to restructure your original request to be a GET, that would probably solve the problem.

    Hope that helps

    Lobster Aliens Are attacking the world!

      Thanks for that.

      Yes changing to a GET solved the problem. Now all I need to do is get the rest of it working (there's always something).

      ++ to both of you.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://245667]
Approved by Corion
[Veltro]: Corion OK, thanks. At least I understand it now.

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2018-05-23 11:31 GMT
Find Nodes?
    Voting Booth?