[Jifty-commit] r4212 - in jifty/trunk: share/plugins/Jifty/Plugin/AutoReference/web/static/js

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Thu Oct 4 11:33:26 EDT 2007


Author: sterling
Date: Thu Oct  4 11:33:24 2007
New Revision: 4212

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/share/plugins/Jifty/Plugin/AutoReference/web/static/js/autoreference.js

Log:
 r6447 at viper:  andrew | 2007-10-04 10:33:05 -0500
 Fixing the data fetcher on the AutoReference box so that it sends the text being typed rather than the current value in the hidden field.


Modified: jifty/trunk/share/plugins/Jifty/Plugin/AutoReference/web/static/js/autoreference.js
==============================================================================
--- jifty/trunk/share/plugins/Jifty/Plugin/AutoReference/web/static/js/autoreference.js	(original)
+++ jifty/trunk/share/plugins/Jifty/Plugin/AutoReference/web/static/js/autoreference.js	Thu Oct  4 11:33:24 2007
@@ -34,5 +34,32 @@
     afterUpdate: function(field, selection) {
         
         Form.Element.validate(this.hiddenField);
+    },
+
+    getUpdatedChoices: function() {
+        var request = { path: this.url, actions: {} };
+
+        var a = $H();
+        a['moniker'] = 'autocomplete';
+        a['class']   = 'Jifty::Action::Autocomplete';
+        a['fields']  = $H();
+        a['fields']['moniker']  = this.action.moniker;
+        a['fields']['argument'] = Form.Element.getField(this.field);
+        request['actions']['autocomplete'] = a;
+        request['actions'][this.action.moniker] = this.action.data_structure();
+        request['actions'][this.action.moniker]['active']  = 0;
+
+        // Fix up the field to use the real field instead of the hidden one
+        request['actions'][this.action.moniker]['fields'][a['fields']['argument']]['value'] = this.field.value;
+
+        var options = { postBody: JSON.stringify(request),
+            onComplete: this.onComplete.bind(this),
+            requestHeaders: ['Content-Type', 'text/x-json']
+        };
+
+        new Ajax.Request(this.url,
+                options
+                );
     }
+
 });


More information about the Jifty-commit mailing list