[Jifty-commit] r3474 - in jifty/trunk: lib/Jifty/Web

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Thu Jun 14 02:15:35 EDT 2007


Author: jesse
Date: Thu Jun 14 02:15:34 2007
New Revision: 3474

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/Web/Form.pm

Log:
 r58297 at pinglin:  jesse | 2007-06-14 02:14:20 -0400
 * Jifty->web->form->next_page got dropped when you submit only a specific action with Jifty->web->form->submit. This commit autoadds next_page if you submit only a subset of actions.


Modified: jifty/trunk/lib/Jifty/Web/Form.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Form.pm	(original)
+++ jifty/trunk/lib/Jifty/Web/Form.pm	Thu Jun 14 02:15:34 2007
@@ -217,7 +217,18 @@
 
 sub submit {
     my $self = shift;
-    my $button = Jifty::Web::Form::Clickable->new(submit => undef, _form => $self, @_)->generate;
+    my %args = (submit => undef,
+                _form => $self,
+                @_);
+
+    my @submit = ref($args{'submit'}) eq 'ARRAY' ? @{$args{'submit'}} : $args{'submit'};
+    if ($self->actions->{'next_page'} && $submit[0] && ! grep {$_->moniker eq 'next_page' } @submit)  {
+        push @submit, $self->actions->{'next_page'};
+        $args{'submit'} = \@submit;
+    }
+
+
+    my $button = Jifty::Web::Form::Clickable->new(%args)->generate;
     Jifty->web->out(qq{<div class="submit_button">});
     $button->render_widget;
     Jifty->web->out(qq{</div>});


More information about the Jifty-commit mailing list