Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
chargill -

my apologies - i knew that it wasn't enough for you to really see what's going on, but what i'm working on is private information, and i didn't want to create a dummy db to demonstrate.

what i have come up with as a workaround is to add ", -value=>'', -override=>1" to each field, as follows:

print table( Tr({-valign=>"TOP"}, td(["First Name", textfield(-name=>'firstname', -size=>80, -value= +>'', -override=>1)]), td(["Last Name", textfield(-name=>'lastname', -size=>80, -value=>' +', -override=>1)]), td(["Address", textfield(-name=>'address1', -size=>80, -value=>'', + -override=>1)]),
setting each value to '' doesn't do it without including the -override=>1

so, this works, but it seems like there must be an easier, more efficient way!

in answer to your inquiries about the rest of my code:

1. #!/usr/bin/perl, 2. use CGI qw/:standard/;,

the top of my script is:
#!/usr/bin/perl use strict; use warnings; use CGI qw(:standard); use CGI::Pretty; use CGI::Carp qw(fatalsToBrowser); use DBI; my $q = new CGI;
i've tried putting -nosticky into the use CGI statement: use CGI qw(:standard, -nosticky); which didn't clear the fields. and i also put '-nosticky' into each of the fields, again, without success (the previous field values remain). i've tried adding the line $q->delete_all(); above the code creating the form when "submit = 'New Entry'", which also doesn't work to clear the field values.
3. the bit of CGI code that displays the button called 'New Entry',
print submit(-name=>'submit',-value=>'New Entry'); the main conditionals that are run look like:
%in = map { $_ => $q->param($_) } $q->param; if ($in{'submit'} ne 'New Entry') { . . $requestID = $in{'requestID'}; $sql = "SELECT title, firstname, lastname, address1, address2, city, s +tate, zipcode, zipextra, phonehome, phonework, phonecell, email, user +name, role, approved FROM members WHERE UID = $requestID"; ....code to generate table with the values from the db inserted into t +he fields... } else { ....code to generate table with empty fields... }
4. enough data stuffed into perhaps __DATA__ to recreate the problem.

the source of the DATA is from a sql statement, as shown above....not sure how to show you this, since it's confidential.


In reply to Re^4: how to use -nosticky in CGI? by jck
in thread how to use -nosticky in CGI? by jck

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 rifling through the Monastery: (4)
As of 2024-04-23 20:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found