Re: CGI.PM and hidden()



dtshedd@xxxxxxxxx wrote:
I am trying to replace this

print "<input type=\"hidden\" name=\"page\" value=$page>\n";

with this

print hidden(-name=>"page", -value=>$page);

problem is that the new line does not print the correct value of $page
(its supposed to change every pass through the perl code),

CGI has "sticky" fields. The value that was just submitted has priority
over the the value specified by -value.

This is usually a good thing. If someone's submission is malformed in one
field, and you need to tell them to change it and resubmit, you want
the new page to retain their previous selections rather than forcing them
to start over with the original defaults (although this argument is less
compelling in the case of hidden fields.)

To change this default behavior for an individual field, specify
-override => 1

You can also turn it off globally by using -nosticky when CGI is "use"d.


I have
tried enclosing the contents of the hidden() command in "{}" but this
made no difference. I am not sure what the role of these brackets
are, some syntax shows them present and other forms of the syntax
shows them absent.

CGI offers an absurd amount of flexibility in how parameters are passed
to it's methods/functions. The list-vs-hash is part of that. It shouldn't
change the behavior.

Xho

--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
.



Relevant Pages

  • FAQ 9.1 What is the correct form of response from a CGI script?
    ... This message is one of several periodic postings to comp.lang.perl.misc ... from the documentation provided with Perl. ... What is the correct form of response from a CGI script? ... The Common Gateway Interface (CGI) specifies a software interface ...
    (comp.lang.perl.misc)
  • FAQ 9.1 What is the correct form of response from a CGI script?
    ... This message is one of several periodic postings to comp.lang.perl.misc ... from the documentation provided with Perl. ... What is the correct form of response from a CGI script? ... The Common Gateway Interface (CGI) specifies a software interface ...
    (comp.lang.perl.misc)
  • Re: Help with a stragegy for diagnosis
    ... I have a Perl CGI that has work for years. ... first failure and before the second. ... A strategy would be to write tests for the script until you get the same ...
    (comp.lang.perl.moderated)
  • Re: Need help with CGI/ DBI error (permissions?)
    ... >> My other Perl CGI scripts that don't use DBI run OK, ... > able to telepathically decipher your web server configuration, ... problems with serving up *Perl* pages. ... you just said that your other CGI scripts run fine. ...
    (comp.lang.perl.misc)
  • Re: How to write to drive A: from CGI Perl
    ... >> If that does not look weird to you, then please go back to basics. ... Please (assuming that the quoted text is an actual excerpt from the HTML ... You will have a better version of Perl? ... for HTML or Perl or CGI or anything. ...
    (comp.lang.perl.misc)