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

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Mon Jun 5 14:17:05 EDT 2006


Author: nelhage
Date: Mon Jun  5 14:17:01 2006
New Revision: 1165

Modified:
   jifty/   (props changed)
   jifty/trunk/share/web/static/js/jifty.js

Log:
 r6842 at phanatique:  nelhage | 2006-06-05 14:07:44 -0400
 Moving the disabling of form fields into the Action class


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	Mon Jun  5 14:17:01 2006
@@ -152,6 +152,12 @@
             { parameters: this.serialize() }
         );
         hide_wait_message();
+    },
+
+    disable_input_fields: function() {
+	this.fields().each(function() {
+		arguments[0].disabled = true;
+	    });
     }
 };
 
@@ -389,8 +395,6 @@
     show_wait_message();
     var named_args = arguments[0];
 
-    disable_fields_for_actions(named_args['actions']);
-    
     // The YAML/JSON data structure that will be sent
     var request = $H();
 
@@ -402,6 +406,7 @@
     for (var i = 0; i < named_args['actions'].length; i++) {
         var moniker = named_args['actions'][i];
         var a = new Action(moniker);
+	a.disable_input_fields();
         if (a.register) {
             if (a.hasUpload())
                 return true;
@@ -610,24 +615,6 @@
         new Effect.Fade('jifty-wait-message', {duration: 0.2});
 }
 
-// Walk all the inputs in the document, disabling any that are related
-// to the action we're performing
-function disable_fields_for_actions (){
-    var actions = arguments[0];
-    inputs = document.getElementsByTagName('input');
-    for(var j = 0; j < inputs.length; j++) {
-	var input = inputs[j];
-	for(var i = 0; i < actions.length; i++) {
-	    var moniker = actions[i];
-	    if(input.id.indexOf(moniker) >= 0) {
-		input.disabled = true;
-		break;
-	    }
-	}
-    }
-}
-
-
 Jifty.Autocompleter = Class.create();
 Object.extend(Object.extend(Jifty.Autocompleter.prototype, Ajax.Autocompleter.prototype), {
   initialize: function(field, div) {


More information about the Jifty-commit mailing list