I have a cgi script that consists of a drop down box that lists a number of servers (pulled from a db) and a number of fields that describe various properies of said servers.
At the moment I have manually set -value=>'unknown' for each field but I would like the default values of each of the fields to be populated with values pulled from a db table (keyed on the server name) the moment a user selects a particular server from the drop down box in the form.
Is there a way to do this other than resorting to javascript?
Here's a snipit of the code as it stands now:
my $hostname_ref = $dbh->selectcol_arrayref("SELECT hostname FROM perm +_inventory ORDER BY hostname"); print $q->header ( "text/html" ), $q->start_html ( -title=>'Modify Server in inventory', -author=> 'devnull@devnull.com', -BGCOLOR=>'orange', -style=>{'src'=>'/form.css'} ), $q->h1 ( "Modify servers into USG inventory" ), $q->hr, $q->start_form( -method => "get", -action => "inv" ), $q->p( "Hostname", $q->popup_menu( -name => "host", -values => $hostname_ +ref) ), $q->p("Vendor", $q->textfield( -name => "vendor", -size => "40", -maxl +ength => "80",-value => "unknown") ), $q->p( "Serial No", $q->textfield( -name => "sn", -size => "40", -maxlengt +h => "80", -value => "unknown") ), $q->p( "Physical Location", $q->textfield( -name => "phy_loc", -size => "40", -max +length => "80", -value => "unknown") ), $q->p( "Raid Config", $q->textfield( -name=>'raid_conf', -size => "40", -max +length => "100", -value => "unknown") ), $q->p( "Function", $q->textfield( -name => "function", -size => "40", -ma +xlength => "60", -value => "unknown") ), $q->p( "Backup Locations", $q->textfield( -name => "bkup_loc", -size => "40", -ma +xlength => "80", -value => "unknown") ), $q->p( "Recovery Media", $q->textfield( -name => "recov_loc", -size => "40", -m +axlength => "80", -value => "unknown") ), $q->submit( -value => "Send to INV cgi"), $q->end_form, $q->end_html;
In reply to cgi drop down boxes triggering form field population by dhj74
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |