I'm writing a web demo that communicates with an XMLRPC server for data, so I'm writing it as 2 frames. A top frame for everything the user would normally use and a bottom frame to show the xmlrpc trace. The UI all hinges round these 3 subs.
The problem is that I can only put items into the log frame by using the target on an HTML link or form but I need a form submitted in the main content area to produce output to the main area and also write some logging information to the log area but write_log & write_content only write to the frame they're called from.
I've RTFM'd and experimeted with using -id and/or -name on the frameset definition.
use CGI ':all'; ## Starting Frameset Definition sub makeframeset { # create document frameset. top area for ui # bottom area for XMLRPC trace my $self = self_url; print header, frameset({-border => "1", -rows => "1*,1*", cols => "*"}, frame({-name => 'main', -src => "$self?run=page"}), frame({-name => 'log', -src => "$self?run=log"}) ), end_html; }
I've also experimented with placing (-target => 'log') on start_html or header for each of these:
## Write a message to the log area sub write_log { # write message to the log frame my $messages = \@_; print header, start_html(-target => 'log'), pre(join "\n", @$messages), end_html; }
## Write content to the main page area sub write_content { # write html to the main frame my $html = \@_; print header, start_html(-target => 'main'), join "\n", @$html, end_html; }
And enough content to make it work
my $run = param("run"); if ($run eq 'log') { write_log('Log Message Area'); } elsif ($run eq 'page') { write_content('Main Area'); write_content("<a href='self_url()'>Simulate Run</a>"); } else { write_content("running..."); write_log("foo"); }
In reply to Outputting to 2 HTML frames from 1 CGI by spatterson
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |