Fix Hidden, Radio and Checkbox, which wouldn't allow

a value of zero to be set in them.  It was translated to
the empty string.
This commit is contained in:
Colin Kuskie 2008-05-05 22:20:16 +00:00
parent fd7a1d28a1
commit c930c73d67
6 changed files with 70 additions and 7 deletions

View file

@ -97,7 +97,8 @@ Renders an input tag of type hidden.
sub toHtmlAsHidden {
my $self = shift;
my $value = $self->fixMacros($self->fixQuotes($self->fixSpecialCharacters($self->getDefaultValue))) || '';
my $value = $self->getDefaultValue;
$value = defined $value ? $self->fixMacros($self->fixQuotes($self->fixSpecialCharacters($value))) : '';
my $idText = $self->get('id') ? ' id="'.$self->get('id').'" ' : '';
return '<input type="hidden" name="'.($self->get("name")||'').'" value="'.$value.'" '.($self->get("extras")||'').$idText.' />'."\n";
}