Hi Monks

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"); }

just another cpan module author

In reply to Outputting to 2 HTML frames from 1 CGI by spatterson

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.