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>";
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.