fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2011-04-19 10:53 am

[dw-free] Poll creator swallows zeros

[commit: http://hg.dwscoalition.org/dw-free/rev/ae12bfaa91d2]

http://bugs.dwscoalition.org/show_bug.cgi?id=3544

"0" sholud be printed in HTML form fields.

Patch by [personal profile] fu.

Files modified:
  • cgi-bin/htmlcontrols.pl
--------------------------------------------------------------------------------
diff -r 99a316c1ecd6 -r ae12bfaa91d2 cgi-bin/htmlcontrols.pl
--- a/cgi-bin/htmlcontrols.pl	Tue Apr 19 18:39:23 2011 +0800
+++ b/cgi-bin/htmlcontrols.pl	Tue Apr 19 18:53:32 2011 +0800
@@ -305,7 +305,7 @@ sub html_text
     my $ret = '';
     $ret .= "<input type=\"$type\"";
     foreach (grep { ! /^(type|disabled|raw|noescape)$/ } keys %$opts) {
-        my $val = $opts->{$_} || '';
+        my $val = defined $opts->{$_} ? $opts->{$_} : '';
         $ret .= " $_=\"" . ( $ehtml ? LJ::ehtml( $val ) : $val ) . "\"";
     }
     if ($opts->{'raw'}) { $ret .= " $opts->{'raw'}"; }
--------------------------------------------------------------------------------