[Jifty-commit] r1800 - jifty/trunk/lib/Jifty/Web/Form
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Sat Aug 12 13:29:23 EDT 2006
Author: nelhage
Date: Sat Aug 12 13:29:22 2006
New Revision: 1800
Modified:
jifty/trunk/lib/Jifty/Web/Form/Element.pm
Log:
onclick => {confirm => 'blahblahblah?'} should work even if you're not
submitting any actions or regions.
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 Sat Aug 12 13:29:22 2006
@@ -160,6 +160,12 @@
$hook->{region} ||= Jifty->web->qualified_region;
+ # Should we show a javascript confirm message?
+ if ($hook->{confirm}) {
+ $confirm = $hook->{confirm};
+ warn "Confirm: $confirm";
+ }
+
# Placement
if (exists $hook->{append}) {
@args{qw/mode path/} = ('Bottom', $hook->{append});
@@ -200,11 +206,6 @@
$args{region} = $args{element} =~ /^#region-(\S+)/ ? "$1-".Jifty->web->serial : Jifty->web->serial;
}
- # Should we show a javascript confirm message?
- if ($hook->{confirm}) {
- $confirm = $hook->{confirm};
- }
-
# Toggle functionality
$args{toggle} = 1 if $hook->{toggle};
@@ -234,9 +235,9 @@
my $update = "update( ". Jifty::JSON::objToJson( {actions => \@actions, fragments => \@fragments }, {singlequote => 1}) .", this );";
$string .= $self->javascript_preempt ? "return $update" : "$update; return true;";
- if ($confirm) {
- $string = "if(!confirm(" . Jifty::JSON::objToJson($confirm, {singlequote => 1}) . ")) return false;" . $string;
- }
+ }
+ if ($confirm) {
+ $string = "if(!confirm(" . Jifty::JSON::objToJson($confirm, {singlequote => 1}) . ")) return false;" . $string;
}
$response .= qq| $trigger="$string"|;
}
More information about the Jifty-commit
mailing list