Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

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

Report information
The Basics
Id: 61415
Status: resolved
Priority: 0/
Queue: HTML-FormHandler

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

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



Hi, I am using HTML::FormHandler with the Model::DBIC. I'm on version 0.32002 of formhandler, and 0.12 of HFH::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. There are also a bunch of warnings emitted, like: Use of uninitialized value $string in substitution (s///) at [..]/HTML/FormHandler/Field.pm line 346, 347, 348 and 349. The code in question is: sub default_render_filter { my ( $self, $string ) = @_; $string =~ s/&/&amp;/g; $string =~ s/</&lt;/g; $string =~ s/>/&gt;/g; $string =~ s/"/&quot;/g; return $string; } Use of uninitialized value in concatenation (.) or string at [..]/HTML/FormHandler/Render/Simple.pm line 195. Which is in render_select(). However neither of those look like they're responsible for missing the values out of the select boxes. 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. What do you think? Thanks, Toby
Was fixed in the HTML::FormHandler::Model::DBIC repo on 9/17