http://qs1969.pair.com?node_id=845838

ady has asked for the wisdom of the Perl Monks concerning the following question:

Felow monks,

I have a cgi.pm based web app., where I want to show / hide a text field dynamically, based on the content of another text field in the app.

Digging into the cgi.pm doc., I can find no property on the field to accomplish this.

Any help / pointers appreciated.
Best regards, - Allan Dystrup.

UPDATE
my $JSCRIPT=<<ENDJS; function show_hide_fields() { var RunCmd = document.getElementById('popRunCmd').value; var rx_ver = new RegExp("^Build"); var test_ver = ( rx_ver.test(RunCmd) ) ? "" : "none"; document.getElementById('div_ver').style.display = test_ve +r; var rx_rc = new RegExp("Build [SB]DP release Produktion") +; var test_rc = ( rx_rc.test(RunCmd) ) ? "" : "none"; document.getElementById('div_rc').style.display = test_rc; } ENDJS print $query->start_html( -title => 'eDP Run Commands', -author => 'and@kmd.dk', -script => $JSCRIPT, -base => 'false', -meta => { 'keywords' => 'eDagpenge build server commands', 'copyright' => 'copyright KMD' }, -bgcolor => '#F1F1F1', -text => '#4F4F4F', ); print "<table>" . "<tr>" . "<td>" . $query->popup_menu( -name => 'popRunCmd', -values => [ # cut out -- a lot of options goes here ... ], -default => ' ', -override => 1, -onChange => 'show_hide_fields()', ) . "</td>" . "<td>" . "<div id='div_ver' style='display:none'>" . textfield( -name => 'version', -value => '', -override => 1, -size => 8, ) . "</div>" . "</td>" . "<td>" . "<div id='div_rc' style='display:none'>" . textfield( -name => 'relcand', -value => '', -override => 1, -size => 4, ) . "</div>" . "</td>" . "</tr>" . "<table>";