All,

This may be more of a HTML question, but it involves using CGI, and I imagine people here will know. What I am trying to do is to have multiple forms of various types which are able to affect one another. What I mean is that if a user selects an option in a popup over here, the options over there will be based upon that selection.

Ultimately these values will be populated by fields in a database, but I will worry about integrating that separately.

It seems impossible to avoid the idea that the page will actually be "redrawn" with each "submit," and I always seem to lose functionality at this point.

I have chopped out parts of a script I was trying to do something similar with, so understand that this code is "chopped"

What I am trying to do here is execute a system script when the user clicks the "Gather site info" button, and have the button change into a "Update site info" button since the initial gathering has already taken place. However, when you click the button, none of the buttons are redrawn. I have done this code a NUMBER of different ways, but I cannot seem to have this basic element of allowing events from one "button" affect other values and still have all other forms on the page stay in tact.

if ($gathered) {print"-!$gathered!-<br>"} #Print forms for displaying Site options if ($import{'site_info'}) { $site = $query->param('site'); $cc = $query->param('country_code'); $query->import_names('F'); $cc = uc($cc); print qq(<br>); print qq(<hr><center>); print $query->start_form; if (!$import{'Gather'}) { print $query->submit('Gather','Gather site info'); } elsif ($import{'Gather'}) { print $query->submit('Update','Update site info'); } print $query->endform; print "<hr>"; print $query->h3("Gather or Update<br>for tools below"); print "<hr>"; print $query->start_form(-method=>'post',-action=>'ap_chan.cgi', -target=>'main'); &hide; print $query->submit('chan_power','Chan/Power'); print $query->endform; print $query->start_form(-method=>'post',-action=>'world_mode.cgi' +, -target=>'main'); &hide; print $query->submit('world_mode','Set World Mode'); print $query->endform; print "<hr>"; print qq(</center>); } print qq(</body>\n</html>); sub hide { while(my($k,$v) = each(%import)) { print $query->hidden($k,$v); } print qq(<INPUT TYPE="hidden" NAME="isp" VALUE="$isp">\n); }
I implore the wisdom of the monks on this one.

In reply to multiple form interaction in cgi by vdubjunkie

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, 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.