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

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Wed Aug 2 14:35:40 EDT 2006


Author: trs
Date: Wed Aug  2 14:35:39 2006
New Revision: 1729

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

Log:
 r15040 at zot:  tom | 2006-08-02 14:35:00 -0400
 Support turning off autocomplete on a per-form basis.  We still need per-field, but that's for later.


Modified: jifty/trunk/lib/Jifty/Web/Form.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Form.pm	(original)
+++ jifty/trunk/lib/Jifty/Web/Form.pm	Wed Aug  2 14:35:39 2006
@@ -5,7 +5,7 @@
 
 use base qw/Jifty::Object Class::Accessor::Fast/;
 
-__PACKAGE__->mk_accessors(qw(actions printed_actions name call is_open));
+__PACKAGE__->mk_accessors(qw(actions printed_actions name call is_open disable_autocomplete));
 
 =head2 new ARGS
 
@@ -23,6 +23,11 @@
 All buttons in this form will act as continuation calls for the given
 continuation id.
 
+=item disable_autocomplete
+
+Disable B<browser> autocomplete for this form.  Jifty autocomplete will still
+work.
+
 =back
 
 =cut
@@ -34,6 +39,7 @@
     my %args = (
         name => undef,
         call => undef,
+        disable_autocomplete => undef,
         @_,
     );
 
@@ -64,12 +70,14 @@
     my $self = shift;
     my %args = (name => undef,
                 call => undef,
+                disable_autocomplete => undef,
                 @_);
 
     $self->actions( {} ) ;
     $self->printed_actions( {} ) ;
     $self->name($args{name});
     $self->call($args{call});
+    $self->disable_autocomplete($args{disable_autocomplete});
 }
 
 
@@ -178,6 +186,7 @@
 
     my $form_start = qq!<form method="post" action="$ENV{PATH_INFO}"!;
     $form_start   .= qq! name="@{[ $self->name ]}"! if defined $self->name;
+    $form_start   .= qq! autocomplete="off"! if defined $self->disable_autocomplete;
     $form_start   .= qq! enctype="multipart/form-data" >\n!;
     Jifty->web->out($form_start);
     $self->is_open(1);


More information about the Jifty-commit mailing list