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:
- use CGI qw(:standard -nosticky);
- putting -nosticky into each of the form elements
- putting -value=>'' into each of the form elements
- 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?
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($,,$;,$*,$/)
| [reply] [Watch: Dir/Any] [d/l] |
|
| [reply] [Watch: Dir/Any] |
|
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)])
]));
| [reply] [Watch: Dir/Any] [d/l] |
|
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:
- #!/usr/bin/perl,
- use CGI qw/:standard/;,
- the bit of CGI code that displays the button called 'New Entry',
- 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($,,$;,$*,$/)
| [reply] [Watch: Dir/Any] [d/l] [select] |
|
|
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. | [reply] [Watch: Dir/Any] |
|
|