Author: jaz
Date: Wed Dec 29 17:15:45 2010
New Revision: 1053678
URL:
http://svn.apache.org/viewvc?rev=1053678&view=revLog:
updated autocomplete functions to fire events (same as selecting from a lookup list) when items are selected from the autocomplete (either by pressing enter or with a mouse click)
Modified:
ofbiz/trunk/framework/images/webapp/images/selectall.js
Modified: ofbiz/trunk/framework/images/webapp/images/selectall.js
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/selectall.js?rev=1053678&r1=1053677&r2=1053678&view=diff==============================================================================
--- ofbiz/trunk/framework/images/webapp/images/selectall.js (original)
+++ ofbiz/trunk/framework/images/webapp/images/selectall.js Wed Dec 29 17:15:45 2010
@@ -416,9 +416,11 @@ function ajaxAutoCompleter(areaCsvString
})
},
select: function(event, ui) {
- jQuery("#" + areaArray[0]).html(ui.item)
- if (showDescription) {
- setLookDescription(areaArray[0] ,ui.item.label, areaArray[2], formName)
+ //jQuery("#" + areaArray[0]).html(ui.item);
+ jQuery("#" + areaArray[0]).val(ui.item.value); // setting a text field
+ jQuery("#" + areaArray[0]).trigger("lookup:changed"); // notify the field has changed
+ if (showDescription) {
+ setLookDescription(areaArray[0] ,ui.item.label, areaArray[2], formName)
}
}
});
@@ -444,6 +446,7 @@ function setLookDescription(textFieldId,
var dependentFieldValue = description.substring(0, description.lastIndexOf(' '))
if (dependentField.length) {
dependentField.val(dependentFieldValue);
+ dependentField.trigger("change"); // let the 'hidden' field know its been changed
}
}
var lookupWrapperEl = jQuery("#" + textFieldId).closest('.field-lookup');
@@ -454,7 +457,7 @@ function setLookDescription(textFieldId,
}
tooltipElement.html(description);
lookupWrapperEl.append(tooltipElement);
- }
+ }
}
}
@@ -491,7 +494,7 @@ function ajaxAutoCompleteDropDown() {
}) );
},
select: function( event, ui ) {
- ui.item.option.selected = true;
+ ui.item.option.selected = true;
//select.val( ui.item.option.value );
self._trigger( "selected", event, {
item: ui.item.option