Subject: | _to_select won't allow specifying none or NULL |
This is from a bug report filed against my Debian package of
Class::DBI::AsForm version 2.42
See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=330173 for full details.
The reporter said:
when _to_select is used for cdbi-has_a-has_many-relationships, there is
no way for the users to specifiy "none", even if a "undef" for that
fields and thus a NULL for the SQL cell would be perfectly acceptible.
Adding
my $sel = HTML::Element->new("option", value => undef);
$sel->attr("selected" => "selected")
if ref $self
and not defined $self->$col;
$sel->push_content("none");
$a->push_content($sel);
before
for (@objs) {
in _to_select fixes the problem for me.