[Jifty-commit] r3412 - in jifty/trunk: lib/Jifty/Web/Form
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Fri Jun 8 17:52:00 EDT 2007
Author: jesse
Date: Fri Jun 8 17:52:00 2007
New Revision: 3412
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty/Web/Form/Element.pm
Log:
r58183 at pinglin: jesse | 2007-06-08 17:51:41 -0400
* We'd gotten the $actions logic slightly wrong during refactoring. The new code lets you submit everything/nothing/something, rather than just something or nothing ;)
Modified: jifty/trunk/lib/Jifty/Web/Form/Element.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Form/Element.pm (original)
+++ jifty/trunk/lib/Jifty/Web/Form/Element.pm Fri Jun 8 17:52:00 2007
@@ -236,7 +236,10 @@
next unless $value;
my @fragments;
- my $actions; # Maps actions => disable?
+ # if $actions is undef, that means we're submitting _all_ actions in the clickable
+ # if $actions is defined but empty, that means we're submitting no actions
+ # if $actions is not empty, we're submitting those actions
+ my $actions = {}; # Maps actions => disable?
my $confirm;
my $beforeclick;
@@ -245,12 +248,14 @@
my %args;
# Submit action
- if ( $hook->{submit} ) {
- %$actions = ();
- my $disable = exists $hook->{disable} ? $hook->{disable} : 1;
+
+
+ if ( exists $hook->{submit} ) {
+ $actions = undef;
+ my $disable_form_on_click = exists $hook->{disable} ? $hook->{disable} : 1;
# Normalize to 1/0 to pass to JS
- $disable = $disable ? 1 : 0;
- $actions->{$_} = $disable for (@{ $hook->{submit} });
+ $disable_form_on_click = $disable_form_on_click ? 1 : 0;
+ $actions->{$_} = $disable_form_on_click for (@{ $hook->{submit} || [] });
}
$hook->{region} ||= Jifty->web->qualified_region;
More information about the Jifty-commit
mailing list