Hi Monks,

I'm not sure how Perlish this will work out to be, but I’ve got an existing Perl CGI application which contains a form, which when submitted with the appropriate values, redisplays that same form (as per the form action).  That part works fine, but I’d like to make it so the submit opens a separate window (browser tab) at the same time, and displays a table in it.  The source of the HTML for that table is in a variable (say $table), not in a file.

The user would then either copy data from that table on the new window to the clipboard, or print the webpage, and when finished the user would close the window leaving them with the original window (which contains the form) only.

(One reason I want a new window is, it has to contain the table only, because I don't want any thing else like navigation controls being included in any printout, and I don't want the user to have to click the browser's back button to get back to the main window.)

I know I could write the HTML in $table out to a file, then display a link to that file (e.g. <a href="table.txt" target="_blank">Click for printable table</a>) on the main window after the submit, which the user could then click, but that’s an extra step for the user which I definitely want to avoid, which is why I’m asking for help.

I’d also prefer not to write the table to a file, mainly because then I have to somehow delete it after it’s been used, which is just more work, but I’m flexible on this.

Any suggestions on how to achieve the above, please?

I'm not wanting any jQuery solutions, but I might be willing to tolerate a bit (or even a byte) of plain JavaScript if required.  I'm using Perl's CGI module, so maybe it has something which could help.

I've also posted this question here: e-e.com/Q_29195399

Thanks. tel2


In reply to Open new window after form submit by tel2

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.