vdubjunkie has asked for the wisdom of the Perl Monks concerning the following question:
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.
I implore the wisdom of the monks on this one.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); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: multiple form interaction in cgi
by snopal (Pilgrim) on Nov 29, 2007 at 16:39 UTC | |
Re: multiple form interaction in cgi
by philcrow (Priest) on Nov 29, 2007 at 16:45 UTC | |
by snopal (Pilgrim) on Nov 29, 2007 at 17:06 UTC | |
by jhourcle (Prior) on Nov 29, 2007 at 18:33 UTC | |
Re: multiple form interaction in cgi
by leocharre (Priest) on Nov 29, 2007 at 17:01 UTC | |
Re: multiple form interaction in cgi
by locked_user sundialsvc4 (Abbot) on Nov 29, 2007 at 19:03 UTC |