Skip Menu |

This queue is for tickets about the HTML-FormHandler-Model-DBIC CPAN distribution.

Report information
The Basics
Id: 61417
Status: resolved
Priority: 0/
Queue: HTML-FormHandler-Model-DBIC

People
Owner: Nobody in particular
Requestors: TJC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.12
Fixed in: (no value)



Subject: Field labels are checked by string validity, not definedness
Hi, I am using HTML::FormHandler with Model::DBIC. I'm on version 0.32002 of formhandler, and 0.12 of Model::DBIC. I have a DB class which has some fields with foreign keys on them, and I'm using formhandler to give me auto-populated select boxes. It worked quite well, except in one case. Some of the foreign tables contain a set of values a bit like this: 0, <-- as in "", an empty string 1,A little bit 2,A bit more 3,A fair bit 4,Plenty 5,Many The problem is that when formhandler renders the form, it doesn't include the zero item in the select box. Looking at Model::DBIC, I see around line 350: foreach my $row (@rows) { my $label = $row->$label_column; next unless $label; # this means there's an invalid value push @options, $row->id, $active_col && !$row->$active_col ? "[ $label ]" : "$label"; } I have changed the middle line there to be: next unless defined $label; After this, the select boxes now include my zero-id and empty-label items. Note the use of "defined" to check validity, rather than checking for a truth value. I think this is probably more correct to do this? yours, Toby
This was fixed back in September.