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

I am using FormMail in a page with two frames. There is a redirect on the submission of the form that works, but it remains in the frameset. I'd like for the script to redirect to a page without frames. Here's the standard script:
if ($Config{'redirect'}) { print "Location: $Config{'redirect'}\n\n"; }

and I've tried this (which does not work):
if ($Config{'redirect'}) { print "Window-target: _top\n"; print "Location: $Config{'redirect'}\n\n"; }

Any help would be great.

Originally posted as a Categorized Question.

Replies are listed 'Best First'.
Re: How to escape frames on form submission
by bbfu (Curate) on Jul 04, 2001 at 23:01 UTC

    All you have to do is add the target="_top" attribute to the <form> tag:

    <form target="_top" method="get" action="url"> blah </form>
Re: How to escape frames on form submission
by voyager (Friar) on Jul 04, 2001 at 02:50 UTC
    If the submisstion was with a link <A> tag then you could set target="_top". Don't know how to do that with a form submission.

    However, on the returned html you can accomplish this with some javascript. The exact syntax escapes me but it's something like

    if self.src != top.src top.src = self.src;
    But this in the body onload() method.
Re: How to escape frames on form submission
by BrentDax (Hermit) on Jul 16, 2001 at 09:46 UTC
    The FORM tag has a TARGET attribute you can use to do this.

    However, I should also note that you should not use FormMail. It has many security bugs in it--you can find details on virtually any other thread where someone mentioned the Accursed Name. (Quick runthrough: it doesn't use and doesn't have well-written CGI parameter algorithms; it doesn't use -T or any similar measures and AFAIK doesn't really check the validity of data; it calls sendmail without making sure the data it feeds it doesn't have evil things in it--basically, it acts as though Perl 4 is in use instead of Perl 5.)