Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
When you use the CGI.pm you can make the parameters 'sticky' specifically you would use CGI qw(:form) (I usually use CGI qw(:standard) here is an example of how you would use this:
#!/usr/bin/perl -w use strict; use CGI qw(:standard); #you can even alter the values of hidden fields based on #the values of other fields if (param('foo') eq 'change') { param('bar','a new value'); } my $txt_textfield=textfield(-name=>'foo', -size=>40); my $txt_hidden=hidden(-name=>'bar', -default=>'I do not want users to see this'); my $cmd_reset=defaults('Reset form'); my $cmd_submit=submit(-name=>'send'); print header( "text/html" ); print start_html( -title => "Sticky values in a form"); print start_form(); #defaults to method get, and action current form print <<FORM; $txt_textfield <br><br> $txt_hidden <br><br> $cmd_submit &nbsp; &nbsp; $cmd_reset FORM print end_form(); print end_html;
copy the code to your cgi-bin and call it in a browser. When you view source note the value of the hidden field. Type 'change' (without quotes) into the text field, submit it and view source again. Also note that the value of the textfield stayed the same (you can change this behavior by using param('foo','') (those are two single quotes) after testing its value. For more information about CGI::Form you can go here: CPAN's CGI::Form page

John

In reply to Re: Form Entry to HTML and Plain text by Cyrnus
in thread Form Entry to HTML and Plain text by belize

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?Last hourOther CB clients
Other Users?
Others about the Monastery: (7)
As of 2024-03-28 21:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found