Hi Web Dev Experts,
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 using Perl's CGI module, so maybe it has something which could help.
I've also posted this question here: https://www.perlmonks.org/?node_id=11122052