[Jifty-commit] r2541 - in jifty/branches/template-declare: .
lib/Jifty/Action lib/Jifty/Web/Form
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Mon Jan 22 19:44:59 EST 2007
Author: trs
Date: Mon Jan 22 19:44:59 2007
New Revision: 2541
Modified:
jifty/branches/template-declare/ (props changed)
jifty/branches/template-declare/lib/Jifty/Action/Record.pm
jifty/branches/template-declare/lib/Jifty/Web/Form/Field.pm
jifty/branches/template-declare/share/web/static/js/bps_util.js
Log:
Mergedown from trunk
r19008 at zot (orig r2538): trs | 2007-01-20 14:20:47 -0500
r19007 at zot: tom | 2007-01-20 14:20:37 -0500
Support for controlling browser-based autocomplete on form fields
r19024 at zot (orig r2539): sterling | 2007-01-20 19:24:38 -0500
Removed assumption that ref is the same as blessed.
r19027 at zot (orig r2540): trs | 2007-01-22 19:44:40 -0500
r19026 at zot: tom | 2007-01-22 19:44:30 -0500
Only run onsubmit() if we have an onsubmit property
Modified: jifty/branches/template-declare/lib/Jifty/Action/Record.pm
==============================================================================
--- jifty/branches/template-declare/lib/Jifty/Action/Record.pm (original)
+++ jifty/branches/template-declare/lib/Jifty/Action/Record.pm Mon Jan 22 19:44:59 2007
@@ -21,6 +21,8 @@
use base qw/Jifty::Action/;
+use Scalar::Util qw/ blessed /;
+
__PACKAGE__->mk_accessors(qw(record _cached_arguments));
=head1 METHODS
@@ -150,7 +152,7 @@
# If the current value is actually a pointer to
# another object, dereference it
$current_value = $current_value->id
- if ref($current_value)
+ if blessed($current_value)
and $current_value->isa('Jifty::Record');
$info->{default_value} = $current_value if $self->record->id;
}
Modified: jifty/branches/template-declare/lib/Jifty/Web/Form/Field.pm
==============================================================================
--- jifty/branches/template-declare/lib/Jifty/Web/Form/Field.pm (original)
+++ jifty/branches/template-declare/lib/Jifty/Web/Form/Field.pm Mon Jan 22 19:44:59 2007
@@ -104,8 +104,8 @@
=cut
-sub accessors { shift->SUPER::accessors(), qw(name label input_name type sticky sticky_value default_value action mandatory ajax_validates ajax_canonicalizes autocompleter preamble hints placeholder focus render_mode length _element_id); }
-__PACKAGE__->mk_accessors(qw(name _label _input_name type sticky sticky_value default_value _action mandatory ajax_validates ajax_canonicalizes autocompleter preamble hints placeholder focus render_mode length _element_id));
+sub accessors { shift->SUPER::accessors(), qw(name label input_name type sticky sticky_value default_value action mandatory ajax_validates ajax_canonicalizes autocompleter preamble hints placeholder focus render_mode length _element_id disable_autocomplete); }
+__PACKAGE__->mk_accessors(qw(name _label _input_name type sticky sticky_value default_value _action mandatory ajax_validates ajax_canonicalizes autocompleter preamble hints placeholder focus render_mode length _element_id disable_autocomplete));
=head2 name [VALUE]
@@ -169,6 +169,10 @@
canonicalized before the action is run, whether or not they also
C<ajax_canonicalize>
+=head2 disable_autocomplete [VALUE]
+
+Gets or sets whether to disable _browser_ autocomplete for this field.
+
=head2 preamble [VALUE]
Gets or sets the preamble located in front of the field.
@@ -486,6 +490,7 @@
$field .= qq! value="@{[Jifty->web->escape($self->current_value)]}"! if defined $self->current_value;
$field .= $self->_widget_class;
$field .= qq! size="@{[ $self->length() ]}" maxlength="@{[ $self->length() ]}"! if ($self->length());
+ $field .= qq! autocomplete="off"! if defined $self->disable_autocomplete;
$field .= " " .$self->other_widget_properties;
$field .= qq! />\n!;
Jifty->web->out($field);
Modified: jifty/branches/template-declare/share/web/static/js/bps_util.js
==============================================================================
--- jifty/branches/template-declare/share/web/static/js/bps_util.js (original)
+++ jifty/branches/template-declare/share/web/static/js/bps_util.js Mon Jan 22 19:44:59 2007
@@ -37,7 +37,8 @@
hidden.setAttribute("type", "hidden");
hidden.setAttribute("name", a.getAttribute("name"));
a["virtualform"].appendChild( hidden );
- a["virtualform"].onsubmit();
+ if ( a["virtualform"].onsubmit )
+ a["virtualform"].onsubmit();
a["virtualform"].submit();
});
}
More information about the Jifty-commit
mailing list