Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

how to use -nosticky in CGI?

by jck (Scribe)
on Dec 18, 2006 at 04:56 UTC ( [id://590381]=perlquestion: print w/replies, xml ) Need Help??

jck has asked for the wisdom of the Perl Monks concerning the following question:

i'm frustrated with trying to figure this out from the docs...hoping someone can help! i have a member directory, which allows me to browse through entries, delete and make edits....i have a button to create a new listing, and i want to show the form with all the fields empty - but no matter what i do, i get the field entries from the last displayed record. i've tried:
  1. use CGI qw(:standard -nosticky);
  2. putting -nosticky into each of the form elements
  3. putting -value=>'' into each of the form elements
  4. inserting the line $q->delete_all()
no matter, i keep getting the previous values displayed in the "new" entry form. any pointers as to what i'm doing wrong?

Replies are listed 'Best First'.
Re: how to use -nosticky in CGI?
by chargrill (Parson) on Dec 18, 2006 at 05:33 UTC

    You're not showing this form from the button via Ajax, are you?

    If you are, I've got a solution or two for you, though they're not perl.

    If not, you'll have to give us a tiny self-contained example that we can run to see this behavior and help you to eliminate it.

    Update: Oh yeah. If you're using FireFox with it's "remember stuff in form fields" option, then it's probably doing that for you and showing you the form with the fields filled in.



    --chargrill
    s**lil*; $*=join'',sort split q**; s;.*;grr; &&s+(.(.)).+$2$1+; $; = qq-$_-;s,.*,ahc,;$,.=chop for split q,,,reverse;print for($,,$;,$*,$/)
      I ran in to a similar problem a while back, but my data was duplicating. If the user hadn't filled out all the requested fields and the name field was John Doe, then it was coming back John DoeJohn Doe after a second submission. Might FireFox's "remember stuff" option be doing that? If so, do you have any idea of a workaround?

      This was a self referencing CGI script if that makes a difference.

      Revolution. Today, 3 O'Clock. Meet behind the monkey bars.
      here's the basics of how i have this:
      print start_form; if ($in{'submit'} eq 'New Entry') { print table( Tr({-valign=>"TOP"}, [ td(["First Name", textfield(-name=>'firstname', -size=>80)]), td(["Last Name", textfield(-name=>'lastname', -size=>80)]) ])); } else { print table( Tr({-valign=>"TOP"}, [ td(["First Name", textfield(-name=>'firstname', -size=>80, -value=>$fi +rstname)]), td(["Last Name", textfield(-name=>'lastname', -size=>80, -value=>$last +name)]) ]));

        So, this isn't self contained, and takes a fair amount of tweaking to make work, and even then I'm not sure I can make it duplicate your behavior. As is, you've left off:

        1. #!/usr/bin/perl,
        2. use CGI qw/:standard/;,
        3. the bit of CGI code that displays the button called 'New Entry',
        4. enough data stuffed into perhaps __DATA__ to recreate the problem.

        Show us enough code that does all that (most importantly #4) that you can run in your environment, so that we can easily run it in our environments to be able to better help you.



        --chargrill
        s**lil*; $*=join'',sort split q**; s;.*;grr; &&s+(.(.)).+$2$1+; $; = qq-$_-;s,.*,ahc,;$,.=chop for split q,,,reverse;print for($,,$;,$*,$/)
XAMPP? mod_perl?
by pvbcharon (Beadle) on Dec 18, 2006 at 16:46 UTC
    I faced that kind of problem a while back when I installed a XAMPP package for testing purpose which by default activated mod_perl... Disabling that did the trick for me.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://590381]
Approved by Popcorn Dave
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2024-03-28 22:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found