Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the CGI CPAN distribution.

Report information
The Basics
Id: 83719
Status: rejected
Priority: 0/
Queue: CGI

People
Owner: Nobody in particular
Requestors: konop039 [...] umn.edu
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: hidden() does not assign the given value to the named element
Date: Fri, 1 Mar 2013 14:51:36 -0600
To: bug-CGI [...] rt.cpan.org
From: Dmitry Konopatski <konop039 [...] umn.edu>
#!/usr/bin/perl # bug-CGI [at] rt.cpan.org =pod Hi, Using the following scenario I am trying to create a hidden input "weather" with an explicitly assigned value of "exciting". The problem is that my input will be assigned a different value of "dull" which comes in the body of the HTTP request. I have not had a chance to come up with a patch, but I am sending you a test script that would allow you to reproduce the issue for the recent versions of CGI.pm Thanks, Dmitry Konopatski =cut BEGIN { use strict; use warnings; use lib qw(lib ../lib); use Test::More; } use CGI; my ($name, $val, $newval) = ("weather", "dull", "exciting"); my $q = CGI->new("$name=$val"); ok(($a = $q->hidden($name, $newval)) !~ /\Q$newval\E/i, $a); ok(($a = $q->hidden($name, $newval)) =~ /\Q$val\E/i, $a); ok(($b = $q->hidden(-name => $name, -default => $newval)) !~ /\Q$newval\E/i, $b); ok(($b = $q->hidden(-name => $name, -default => $newval)) =~ /\Q$val\E/i, $b); ok($a eq $b, "HTML is the same"); ok(($a = $q->hidden(-name => $name, -default => $q->param("weather", $newval))) =~ /\Q$newval\E/i, "Workaround 1"); ok(($b = $q->input({type => "hidden", name => $name, value => $newval})) =~ /\Q$newval\E/i, "Workaround 2"); done_testing();
Subject: Re: [rt.cpan.org #83719] hidden() does not assign the given value to the named element
Date: Thu, 07 Mar 2013 16:39:26 -0500
To: bug-cgi [...] rt.cpan.org
From: Mark Stosberg <mark [...] summersault.com>
You've run into the documented "sticky" behavior. See -nosticky in the docs for more detail about the feature and how to disable it. Mark