CGI.pm sticky hidden fields: why?

W

wana

Is there any justification for the 'stickiness' of hidden fields? A
web page viewer cannot legitimately enter a value into a hidden field,
so why would anyone want to hold over a value to the next page?

I really got stuck on this one for a while because I was creating a
session and passing the session id in a hidden field and it was
getting stuck there and not changing when it was supposed to until I
added -override=>1.

Also, in passing session id via url, Konqueror seems to have a problem
with this. Even with sample code from the Perl and MySQL book, I had
to go to the address bar and press enter each time as if I was typing
in the address with session id each time for it to work. I did not
bother to test this with Netscape since I prefer passing by hidden
field and that seems to work now that I know they are sticky.
 
A

Alan J. Flavell

(e-mail address removed) (Randal L. Schwartz) wrote:

} It's not really for the *next* page. It's when you want to redisplay
} *this* page because of an error.

Interesting balancing: I display *scores* of pages and rarely run into a
'redisplay'.

Maybe you use forms in a different way, then...
} Good design guidelines say that when you redisplay the current
page } with errors flagged that you default to the previous value.
The code } to do that manually would be hard to remember to include,
so I'm glad } the default is "sticky".

Seems reasonable to me.
Interesting, the other side of the coin is that you have to remember
*ALL*THE*TIME* that if you change a value it *wont*get*changed* and so
you'l come back into your CGI with wrong stuff... You slip up once
remembering to stick in the annoying "-override" and your CGI pgm
misbehaves.

If that's what you *routinely* want, then you'd be better advised
to use the -nosticky pragma. Documented below
http://stein.cshl.org/WWW/software/CGI/#import
so I really think the default is the wrong way

I guess that a default is always the wrong way for *somebody*...
[and at the least, I wish there was a way to say "no thank you" to
it]

In what way does -nosticky fall short of your needs?

cheers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top