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

I've read a few questions relating to this subject but the answers haven't really anwered my particular question. I have a login form written in Perl which calls itself on submit to either re-display the form with an error message or do something else. I want the 'do something else' to output a static html page in another frame. I have tried many variations on this code but the page always appears in the same frame. I got the impression from another question that this may not even be possible in Perl. Can anyone help?(code snippet below)
print "Window-target: MenuBar\nLocation: ../game_nav.html\n\n";

Replies are listed 'Best First'.
Re: Frame Redirection
by Masem (Monsignor) on Nov 20, 2001 at 17:04 UTC
    The guarenteed way that this will work (eg no javascript, no browser trickery) is that you would have to regenerate the entire frameset and their contents when you reply to the user's request, making sure that your toplevel frameset doc points to a top level window target _main. This isn't too hard with CGI and perl, as you can use the same script to generate the top level frame and the individual frames by wisely using CGI parameters in the links ( for example, if there is no 'frame' param, then you should draw the toplevel frame, and make sure to set 'frame' to the specific panels when you include the source doc references. If there is a 'frame' param, you know exactly what needs to be put into those panels, and can take action appropriately. If done right, you will carry all the CGI params across the panel generation, and thus can use that information (and cookies, etc) to keep frames in-sync. The only downside to this is that your script will run N frames + 1 times, as opposed to just once, to generate the new pages.

    -----------------------------------------------------
    Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain
    "I can see my house from here!"
    It's not what you know, but knowing how to find it if you don't know that's important

      I believe target=_top would be appropriate.

      --
      perl -p -e "s/(?:\w);([st])/'\$1/mg"

Re: Frame Redirection
by mpolo (Chaplain) on Nov 20, 2001 at 16:37 UTC
    I've never seen the "Window-target" protocol. What I have done to get the same result is call up a dynamically generated frame set that has the new window... That is, my form has an IF-THEN-ELSIF (or SWITCH-surrogate) structure to select which frameset information gets printed to the browser. (Using cgi.pm, of course.)

    In my particular implementation, however, this worked only for the IE browser. (This was an all CGI section -- nothing was static, and Netscape doesn't seem to like frameset.cgi putting other CGIs into the child frames, while IE survived.) You could most likely overcome this problem, but I was working on an Intranet where everyone (except me) used exclusively IE, so it wasn't worth my time...

      There is a header that CGI.pm uses (I don't remember the exact method) that will print to new frames but I believe it only works in Netscape. Maybe you could combine this with what mpolo said above. Check the CGI man page
Re: Frame Redirection
by hatter (Pilgrim) on Nov 20, 2001 at 16:06 UTC
    I fear this requires javascript. I've not seen the Window-target: header before (but then I've not really kept up with where I'd expect to find it)

    However, if you can issue that header in any other served script, you should be able to do the same in perl. Find an example of a page that does what you want, manually telnet to the server and request the document, then do the same for your page. I'd put money on you spotting something obvious missing/typo'd/etc in your version.

    the hatter

(jryan) Re: Frame Redirection
by jryan (Vicar) on Nov 20, 2001 at 20:59 UTC
      Thanks but I've already seen these and they don't answer my particular problem. According to the CGI documentation it is possible but having used the syntax they suggest, it still doesn't work. What are we coming to if the CGI documentation is giving out incorrect information??