--- trunk/lib/Frey/Action.pm 2009/01/09 23:02:36 977
+++ trunk/lib/Frey/Action.pm 2009/01/09 23:17:23 978
@@ -104,6 +104,14 @@
sub params_form {
my ( $self ) = @_;
+
+ foreach my $checkbox ( split(/\s+/, $self->params->{'frey-checkboxes'} ) ) {
+ next if defined $self->params->{ $checkbox };
+
+ $self->params->{ $checkbox } = 0;
+ warn "# checkbox $checkbox not ticked";
+ }
+
my $required = $self->required('as_hash');
if ( $required ) {
warn $self->class, " required params ", dump( keys %$required ) if $self->debug;
@@ -193,14 +201,6 @@
}
- foreach my $checkbox ( split(/\s+/, $default->{'frey-checkboxes'} ) ) {
- next if defined $default->{ $checkbox };
-
- $default->{ $checkbox } = 0;
- $self->params->{ $checkbox } = 0;
- warn "# checkbox $checkbox not ticked";
- }
-
my @checkboxes;
my $label_width = 1; # minimum
@@ -225,7 +225,7 @@
my $value =
defined $default->{$name} ? $default->{$name} :
$attr->has_default ? $attr->default( $name ) :
- '';
+ undef;
if ( ref($params_config) eq 'HASH' && defined $params_config->{$name} ) {
$value = $params_config->{$name};
@@ -236,8 +236,8 @@
$value_html = select_values( $name, $attr_type, $attr->type_constraint->values );
} elsif ( $attr_type =~ m{^Bool} ) {
my $suffix = '';
- $suffix = ' checked' if $value;
- $value_html = qq||;
+ $suffix = ' checked=1' if $value;
+ $value_html = qq||;
push @checkboxes, $name;
} elsif ( ! defined $value ) {
$value_html = qq|undef|; # FIXME if $self->debug