[jifty-devel] Combobox in J::A::UpdateXxx

David Good dgood at willingminds.com
Mon Apr 30 19:19:29 EDT 2007


On Mon, Apr 23, 2007 at 11:06:58PM -0700, David Good wrote:
> I'm trying to do a pretty easy UpdateXxx action but I want some of the fields
> to be updated to be rendered as comboboxes.  I tried just adding "render as
> 'Combobox'" and "available are qw( 10 20 30 40 50 60 70 80 90 )" to the model
> schema (the values are percentages), but when Jifty attempts to render them I
> get:
> 
> WARN - Can't use an undefined value as an ARRAY reference at <perl_path>/lib/perl5/site_perl/5.8.8/Jifty/Web/Form/Field/Combobox.pm line 38.
> 
> Do I need to subclass MyApp::Action::Record::UpdateXxx just to be able to
> render a combobox?  

I found the problem.  There's a simple logic bug in Jifty::Action when you use
'available' instead of 'available_values'.  Here's a patch:

--- Action.pm.orig      2007-04-30 16:10:25.000000000 -0700
+++ Action.pm   2007-04-30 16:12:53.000000000 -0700
@@ -987,7 +987,7 @@

     my $vv_orig = $self->arguments->{$field}{$type .'_values'};
     local $@;
-    my @values = eval { @$vv_orig } or return $vv_orig;
+    my @values = eval { @$vv_orig } and return $vv_orig;

     my $vv = [];


More information about the jifty-devel mailing list