[Jifty-commit] r1417 - in jifty/trunk: share/web/static/js

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Sat Jul 1 08:23:55 EDT 2006


Author: seanmil
Date: Sat Jul  1 08:23:50 2006
New Revision: 1417

Modified:
   jifty/trunk/lib/Jifty/Web/Form/Field.pm
   jifty/trunk/share/web/static/js/jifty.js

Log:
* Make AJAX canonicalizations work even when AJAX validations aren't used

Modified: jifty/trunk/lib/Jifty/Web/Form/Field.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Form/Field.pm	(original)
+++ jifty/trunk/lib/Jifty/Web/Form/Field.pm	Sat Jul  1 08:23:50 2006
@@ -100,8 +100,8 @@
 
 =cut
 
-sub accessors { shift->SUPER::accessors(), qw(name label input_name type sticky sticky_value default_value action mandatory ajax_validates autocompleter preamble hints render_mode length _element_id); }
-__PACKAGE__->mk_accessors(qw(name _label _input_name type sticky sticky_value default_value _action mandatory ajax_validates autocompleter preamble hints 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 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 render_mode length _element_id));
 
 =head2 name [VALUE]
 
@@ -148,6 +148,15 @@
 validated before the action is run, whether or not they also
 C<ajax_validate>.
 
+=head2 ajax_canonicalizes [VALUE]
+
+A boolean value indicating if user input into an HTML form field for
+this argument should be L<canonicalized|Jifty::Manual::Glossary/canonicalize>
+via L<AJAX|Jifty::Manual::Glassary/AJAX> as the user fills out the
+form, instead of waiting until submit.  Arguments will B<always> be
+canonicalized before the action is run, whether or not they also
+C<ajax_canonicalize>
+
 =head2 id 
 
 For the purposes of L<Jifty::Web::Form::Element>, the unique id of
@@ -444,8 +453,9 @@
     my $self = shift;
     my @classes = ( 'widget',
                     $self->classes,
-                    ( $self->ajax_validates ? ' ajaxvalidation' : '' ),
-                    ( $self->autocompleter  ? ' ajaxautocompletes' : '' ),
+                    ( $self->ajax_validates     ? ' ajaxvalidation' : '' ),
+                    ( $self->ajax_canonicalizes ? ' ajaxcanonicalization' : '' ),
+                    ( $self->autocompleter      ? ' ajaxautocompletes' : '' ),
                     @_ );
 
     return qq! class="!. join(' ', at classes).  qq!"!

Modified: jifty/trunk/share/web/static/js/jifty.js
==============================================================================
--- jifty/trunk/share/web/static/js/jifty.js	(original)
+++ jifty/trunk/share/web/static/js/jifty.js	Sat Jul  1 08:23:50 2006
@@ -368,7 +368,7 @@
 
 // Form elements should AJAX validate if the CSS says so
 Behaviour.register({
-    'input.ajaxvalidation, textarea.ajaxvalidation': function(elt) {
+    'input.ajaxvalidation, textarea.ajaxvalidation, input.ajaxcanonicalization, textarea.ajaxcanonicalization': function(elt) {
         elt.onblur = function () {
             Form.Element.validate(this);
         }


More information about the Jifty-commit mailing list