Make sure value is not padded with spaces

This commit is contained in:
Nathan Gray 2014-01-20 13:59:58 +00:00
parent b3b4bc7dde
commit f8a361c0bc

View File

@ -623,7 +623,13 @@ var et2_link_entry = et2_inputWidget.extend(
// Autocomplete // Autocomplete
this.search.autocomplete({ this.search.autocomplete({
source: function(request, response) { return self.query(request, response);}, source: function(request, response) { return self.query(request, response);},
select: function(event, item) { event.data = self; self.select(event,item); return false;}, select: function(event, item) {
event.data = self;
// Correct changed value from server
item.item.value = item.item.value.trim();
self.select(event,item);
return false;
},
focus: function(event, item) { focus: function(event, item) {
event.stopPropagation(); event.stopPropagation();
self.search.val(item.item.label); self.search.val(item.item.label);
@ -892,6 +898,8 @@ var et2_link_entry = et2_inputWidget.extend(
* User selected a value * User selected a value
*/ */
select: function(event, selected) { select: function(event, selected) {
// Correct changed value from server
selected.item.value = selected.item.value.trim();
if(this.options.select && typeof this.options.select == 'function') if(this.options.select && typeof this.options.select == 'function')
{ {
if(!this.options.select(event, selected)) return false; if(!this.options.select(event, selected)) return false;