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

Juergen Mathwich jux at 4950.net
Fri Oct 31 08:50:47 GMT 2008


Am Freitag 31 Oktober 2008 09:47:39 schrieb Carl Franks:
> 2008/10/31 Juergen Mathwich <jux at 4950.net>:
> > Hi Michele
> >
> > Thanks for your reply.
> >
> > I read following information from this thread
> > http://lists.scsys.co.uk/pipermail/html-formfu/2008-August/001334.html
> >
> >> If you're using hand-rolled code to update the database - be aware
> >> that the browser doesn't send anything back for unchecked checkboxes -
> >> not even an empty value - so either your db-update code will need to
> >> check the FormFu form object for checkboxes that haven't been
> >> submitted, or you'll need to use 'default_empty_value'.
> >>
> >> Carl
> >
> > This is why i *thought* default_empty_value should set it to "0" (the
> > default value) if used.
> >
> > Regarding your reply I missunderstood the behavior - default_empty_value
> > causes process() to add the key to the hash if the box isn't checked, but
> > not to set a default value.
> >
> > Possible solutions are:
> >
> > 1. run through the result and set unset checkbox values to 0
> > 2. use transformers (like you suggested)
> > 3. add the suggested "default_if_unchecked" to formfu
>
> Are you using HTML-FormFu-Model-DBIC ?
> As long as DBIC is told the field corresponding to the checkbox is not
> nullable, it'll take care of this for you, and set it to zero.
>
> Carl
>
> _______________________________________________
> HTML-FormFu mailing list
> HTML-FormFu at lists.scsys.co.uk
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu


Nope, I have to handle the data myself and can't use DBIC here.

Juergen




More information about the HTML-FormFu mailing list