mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 23:00:56 +01:00
Make sure value is numeric.
Fixes user/group selection sometimes doubled an option
This commit is contained in:
parent
35dc435ab9
commit
3084da2238
@ -176,6 +176,9 @@ var et2_selectAccount = et2_selectbox.extend(
|
|||||||
this.search_widget.select = function(e, selected) {
|
this.search_widget.select = function(e, selected) {
|
||||||
var current = self.getValue();
|
var current = self.getValue();
|
||||||
|
|
||||||
|
// Fix ID as sent from server - must be numeric
|
||||||
|
selected.item.value = parseInt(selected.item.value);
|
||||||
|
|
||||||
// This one is important, it makes sure the option is there
|
// This one is important, it makes sure the option is there
|
||||||
old_select.apply(this, arguments);
|
old_select.apply(this, arguments);
|
||||||
|
|
||||||
@ -379,9 +382,16 @@ var et2_selectAccount = et2_selectbox.extend(
|
|||||||
},
|
},
|
||||||
'select': function(e, selected) {
|
'select': function(e, selected) {
|
||||||
// Make sure option is there
|
// Make sure option is there
|
||||||
if(typeof self.options.select_options[selected.item.value] == 'undefined')
|
var already_there = false;
|
||||||
|
var last_key = null;
|
||||||
|
for(last_key in self.options.select_options)
|
||||||
{
|
{
|
||||||
self.options.select_options[selected.item.value] = selected.item;
|
var option = self.options.select_options[last_key];
|
||||||
|
already_there = already_there || (typeof option.value != 'undefined' && option.value == selected.item.value);
|
||||||
|
}
|
||||||
|
if(!already_there)
|
||||||
|
{
|
||||||
|
self.options.select_options[parseInt(last_key)+1] = selected.item;
|
||||||
self._appendOptionElement(selected.item.value, selected.item.label);
|
self._appendOptionElement(selected.item.value, selected.item.label);
|
||||||
}
|
}
|
||||||
self.set_value(selected.item.value);
|
self.set_value(selected.item.value);
|
||||||
@ -416,7 +426,9 @@ var et2_selectAccount = et2_selectbox.extend(
|
|||||||
// Don't show normal drop-down
|
// Don't show normal drop-down
|
||||||
search_widget.search.data("ui-autocomplete")._suggest = function(items) {
|
search_widget.search.data("ui-autocomplete")._suggest = function(items) {
|
||||||
jQuery.each(items, function (index, item) {
|
jQuery.each(items, function (index, item) {
|
||||||
self._add_search_result(results, item);
|
// Make sure value is numeric
|
||||||
|
item.value = parseInt(item.value);
|
||||||
|
self._add_search_result(results, item);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user