[html-formfu] Model-DBIC and problem with save_to_model

Carl Franks fireartist at gmail.com
Thu Feb 14 11:32:44 GMT 2008


On 13/02/2008, Andreas Marienborg <omega at palle.net> wrote:
> I have a checkbox in my form, and if I try to check it, I get the
>  following from Model-DBIC:
>
>  [error] DBIx::Class::Row::update_or_insert(): DBI Exception:
>  DBD::Pg::st execute failed: ERROR:  invalid input syntax for type
>  boolean: "on"
>   [for Statement "UPDATE bookmark SET modified = ?, private = ? WHERE
>  ( id = ? )" with ParamValues: 1='1202893030', 3='263', 2='on'] at /
>  Users/andreas/Projects/opensource/html-formfu-trunk/HTML-FormFu/lib/
>  HTML/FormFu/Model/DBIC.pm line 270
>
>  which is as expected I guess.
>  Setting value: 1 on the checkbox fixes it
>
>  We might want to consider special-casing boolean fields and checkboxes?

I suppose we could do that.

Though I think I'd consider setting default('on') for a Bool
column-type rather than default(1), a "user error" ;)

There's already logic in _save_columns() for unchecked checkboxes, so
this could be added alongside that.

Carl



More information about the HTML-FormFu mailing list