[Jifty-commit] r1740 - jifty/trunk/lib/Jifty/Web

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Thu Aug 3 12:18:41 EDT 2006


Author: nelhage
Date: Thu Aug  3 12:18:37 2006
New Revision: 1740

Modified:
   jifty/trunk/lib/Jifty/Web/Form.pm

Log:
Writing out state variables at the start of forms, instead of at the
end. 

Modified: jifty/trunk/lib/Jifty/Web/Form.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Form.pm	(original)
+++ jifty/trunk/lib/Jifty/Web/Form.pm	Thu Aug  3 12:18:37 2006
@@ -189,6 +189,12 @@
     $form_start   .= qq! autocomplete="off"! if defined $self->disable_autocomplete;
     $form_start   .= qq! enctype="multipart/form-data" >\n!;
     Jifty->web->out($form_start);
+
+    # Write out state variables early, so that if a form gets
+    # submitted before the page finishes loading, the state vars don't
+    # get lost
+    $self->_preserve_state_variables();
+
     $self->is_open(1);
     '';
 }
@@ -230,7 +236,6 @@
     Jifty->web->out( qq!<div class="hidden">\n! );
 
     $self->_print_registered_actions();
-    $self->_preserve_state_variables();
     $self->_preserve_continuations();
 
     Jifty->web->out( qq!</div>\n! );


More information about the Jifty-commit mailing list