<snip>
The only issue I had was with checkboxes filled in from the database,
since CGI does not send back a value for unchecked checkboxes then
FillInForm would not handle them correctly so I had to develop a
work-around.

Regards
Ian Docherty (IcyDee)


Oh, amazing! I was just starting to write a post asking something like
that, although my problem showed on radiobuttons (e.g. option 0=No
doesn't get selected), using Formbuilder, but I think it's the same
principle.  Would you please show/explain your workaround? In the
meanwhile, I just tried using "false" instead of "0" (works for
inserting/updating, at least with PostgreSQL) and converting "0" to
"false" when filling form, but I don't think it's really elegant...

Regards,
Juan


Juan
I have a hidden field in the form 'action' which is true when the form is submitted, but false the first time the form is displayed (from the database). Then for a checkbox (and I assume this could be extended to radio buttons) I do the following in my template.

<input name="user_active" type="checkbox" [% IF user.active and not action %]checked[% END %]>

So, first time round the 'checked' values depends only on the user.active flag (from the database) on subsequent times round (for example when a form error was found) and 'action' is set then the state of the checkbox is handled by FillInForm.

Without the 'and not action' bit if the database had 'user.active' set then if an attempt to uncheck the checkbox was made, and if there was an error on the form elsewhere, FillInForm would not uncheck the box.

Regards
Ian Docherty (IcyDee)


_______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to