[html-formfu] 'default_empty_value' doesn't work

Juergen Mathwich jux at 4950.net
Thu Oct 30 17:41:20 GMT 2008


Hi

I have a (part of) a form like this:

$VAR1 = {                                                       
          'default_empty_value' => 1,                           
          'constraints' => [                                    
                             {                                  
                               'type' => 'Bool'                 
                             }                                  
                           ],                                   
          'checked' => 'checked',                               
          'value' => 1,                                         
          'name' => 'ACTIVE',                                   
          'default' => 0,                                       
          'type' => 'Checkbox'                                  
        };         

After submitting the form data, Catalyst/Formfu doesn't show me the value if 
the checkbox is unchecked - but I expected a different result due to 
"default_empty_value".

Dumping the result as follows:

    if ( $form->submitted_and_valid() ) {
        ....
        $data = $form->params();
        warn Dumper $data;
       ..... 

shows me that it is empty, not 0 as expected:

          'ACTIVE' => '',           

Of course I could loop throu all unset checkbox results and set them 0, but 
shouldn't this be done by formfu automatically? 

Regards 
Juergen





More information about the HTML-FormFu mailing list