changeset 8:1f9c278126f9

Don't put the value twice in autocomplete fields.
author Franck Deroche <franck@defr.org>
date Tue, 27 Jan 2009 11:55:21 +0100
parents 281e131cb6c3
children b942365b70eb
files noderef_view.js
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/noderef_view.js	Tue Jan 27 11:54:25 2009 +0100
+++ b/noderef_view.js	Tue Jan 27 11:55:21 2009 +0100
@@ -25,10 +25,12 @@
         var selection = noderef_view_get_selection(), left = [];
         for(nid in selection) {
           count = 0;
+          // Let's compute the potential value for autocomplete fields
+          acvalue = selection[nid] +' [nid:'+ nid +']';
           // Autocomplete field
-          count += $('input.form-autocomplete:not([value])', wrapper)
+          count += $('input.form-autocomplete[value="'+ acvalue +'"], input.form-autocomplete:not([value])', wrapper)
             .filter(':first')
-            .val(selection[nid])
+            .val(acvalue)
             .length;
           // Select field (exclude the weight of autocomplete fields)
           count += $('select:not([id$="--weight"])', wrapper).val(nid).length;