Mercurial > defr > drupal > noderef_view
comparison noderef_view.js @ 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 |
comparison
equal
deleted
inserted
replaced
7:281e131cb6c3 | 8:1f9c278126f9 |
---|---|
23 // completion of the popup select form | 23 // completion of the popup select form |
24 $(document).bind('popups_form_success.noderef_view', function() { | 24 $(document).bind('popups_form_success.noderef_view', function() { |
25 var selection = noderef_view_get_selection(), left = []; | 25 var selection = noderef_view_get_selection(), left = []; |
26 for(nid in selection) { | 26 for(nid in selection) { |
27 count = 0; | 27 count = 0; |
28 // Let's compute the potential value for autocomplete fields | |
29 acvalue = selection[nid] +' [nid:'+ nid +']'; | |
28 // Autocomplete field | 30 // Autocomplete field |
29 count += $('input.form-autocomplete:not([value])', wrapper) | 31 count += $('input.form-autocomplete[value="'+ acvalue +'"], input.form-autocomplete:not([value])', wrapper) |
30 .filter(':first') | 32 .filter(':first') |
31 .val(selection[nid]) | 33 .val(acvalue) |
32 .length; | 34 .length; |
33 // Select field (exclude the weight of autocomplete fields) | 35 // Select field (exclude the weight of autocomplete fields) |
34 count += $('select:not([id$="--weight"])', wrapper).val(nid).length; | 36 count += $('select:not([id$="--weight"])', wrapper).val(nid).length; |
35 // Radio field | 37 // Radio field |
36 count += $('input:radio[value='+ nid + '], input:checkbox[value='+ nid +']', wrapper) | 38 count += $('input:radio[value='+ nid + '], input:checkbox[value='+ nid +']', wrapper) |