UncleRon has asked for the wisdom of the Perl Monks concerning the following question:

Oh wise and wonderful monks, I am creating work orders from data stored in a file. I would like the work orders to be presented in a window. Like UPS does on its site when you go to print the label. Then my customers would be able to print a work order and close the window and either return to the screen that requested the work orders or find that there is another work order "underneath" the first one. So you see I want to layer the work orders as they are created, each one in it's own little window. I tried fiddling with CGI::header(), but either I don't have the right switches or it's not the way to do this. I've looked at UPS and other sites. The only thing I've discovered is they use JavaScript to do this. Is there a better way using Perl and CGI? Your devoted supplicant, Uncle Ron

Replies are listed 'Best First'.
Re: Outputting to new windows
by Gerard (Pilgrim) on Jan 12, 2004 at 20:02 UTC
    UncleRon,
    Javascript is the way to do this. It is pretty easy, add something like this to your html code
    onClick="window.open('http://yoursite.com/script.pl?workorder=yes&cust +omer=0876','mywindow','width=400,height=200')"

    You can pass information to your script using valu pairs in the url like above. As far as I am aware, there is no server side way to do this, you have to use a client side scripting technology such as javascript. You can get more information on that javascript here if you are interested.
    Regards, Gerard
Re: Outputting to new windows
by cLive ;-) (Prior) on Jan 12, 2004 at 20:26 UTC
    If you know users are using newer browsers, you could use CSS and Z Index properties and keep everything in one window.

    Basically, however you do it, it will require JavaScript that you will need to generate from your CGI script.

    .02

    cLive ;-)

Re: Outputting to new windows
by Art_XIV (Hermit) on Jan 12, 2004 at 20:46 UTC

    Even easier than Javascript... even easier than Perl... set the the target attribute in your anchor tags:

    Click <A HREF="./cgi-bin/worders.pl" target="newwindow">here</A> for work order.

    Of course, the user does have to click on the anchor for this to work.

    Hanlon's Razor - "Never attribute to malice that which can be adequately explained by stupidity"
Re: Outputting to new windows
by maa (Pilgrim) on Jan 12, 2004 at 19:58 UTC

    Hi, UncleRon

    There seem to be a few nodes about this... if your site uses Perl to create the work orders and stuff then just have it send the JavaScript to the browser, too.

    Search Perlmonks