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>";

In reply to Show / hide text field in cgi.pm application by ady

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.