Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

How to escape frames on form submission

( #93711=categorized question: print w/ replies, xml ) Need Help??
Contributed by Zombie writhe on Jul 04, 2001 at 02:24 UTC
Q&A  > CGI programming


Description:

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.

Answer: How to escape frames on form submission
contributed by bbfu

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

<form target="_top" method="get" action="url"> blah </form>
Answer: How to escape frames on form submission
contributed by voyager

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.
Answer: How to escape frames on form submission
contributed by BrentDax

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 CGI.pm 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.)

Please (register and) log in if you wish to add an answer



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • 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, 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, 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others contemplating the Monastery: (14)
    As of 2015-07-30 14:56 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









      Results (271 votes), past polls