CGI / Frames question

Sandy Norton sandskyfly at
Tue Aug 20 05:13:33 CEST 2002

Paul Rubin wrote in message:
> sandskyfly at (Sandy Norton) writes:
> > What I specifically would like to do is have the user click on
> > 'submit_b' from the control frame (control.html) and pass on the
> > differences in state from _both frames_ to the python cgi script. It
> > would be as if both 'submit_a' and 'submit_b' were somehow pressed
> > simultaneously.
> > 
> > Is this possible?
> > 
> > Any help would be much appreciated,
> Simplest way is with client side javascript, I'll leave the details to you.

I suspected as much before and your pointer confirmed this to me... 
Following your advice I did a bit of digging through javascript and
found a way to do it (-:

<frameset rows="*,45" frameborder="NO" border="0" framespacing="0"
  <frame name="contentFrame" src="content.html">
  <frame name="controlFrame" scrolling="NO" noresize

function getElements(es) {
    s = "";
    for (var i=0; i < es.length; i++) {
        if (es[i].checked)
            s += es[i].name + ":" + es[i].value + " | ";
    return s;
function sendForm() {
    if (parent.contentFrame.document.contentForm) {
        var es = parent.contentFrame.document.contentForm.elements;
        parent.controlFrame.document.controlForm.articles.value =

<script language="JavaScript" type="text/javascript"
    name="controlForm" method="get" action="cgi-bin/" 
    target="contentFrame" onsubmit="sendForm()"
    <input type="submit" value="go">
    <input type="hidden" name="articles">

<form action="cgi-bin/" method="get" name="contentForm">
    <input type='checkbox' name='field1' value="a"> <a
href=''>article 1</a>
    <input type='checkbox' name='field2' value="b"> <a
href=''>article 2</a>
    <input type="submit" name="submit_a" value="go">

Basically you convert all the data you want from the content frame's
form into a string, and then pass it into a hidden input var in the
control frame's form which is subsequently to a cgi script after a

Incidentally, client-side javascripting was truly a PIT. (I am truly
spoilt by python's introspective qualities.)

Back to some fun code now...



More information about the Python-list mailing list