Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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":



  • 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.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2022-11-26 22:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?