Jacques, When using the auto complete, the value isn't properly set until after the description is parsed. The value field may contain the key and the description until after it is parsed out. The onchange event runs before this happens, so it needs to be called after the string is parsed and placed into the proper fields.
That explains why the onchange event is called from here. The reason the onchange event is called in the first place is because these events don't trigger when you set values programmatically only when the value is actually changed by the user (through the browser). So we call the event manually to make sure any listeners are notified. --- Andrew Zeneski [email protected] ---------- Forwarded message ---------- From: "Jacques Le Roux" <[email protected]> To: <[email protected]> Date: Sun, 7 Nov 2010 16:49:50 +0100 Subject: Re: svn commit: r1031655 - /ofbiz/trunk/framework/images/webapp/images/selectall.js Hi Andrew, I try to understand how and when this is helpful. In other words why did you add this? Could you please give an example? This question because I wonder if I should use it in the jQuery branch. Thanks Jacques From: <[email protected]> Author: jaz Date: Fri Nov 5 16:13:00 2010 New Revision: 1031655 URL: http://svn.apache.org/viewvc?rev=1031655&view=rev Log: small change to call the onchange event when updating the autocomplete fields after the description is set 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=1031655&r1=1031654&r2=1031655&view=diff ============================================================================== --- ofbiz/trunk/framework/images/webapp/images/selectall.js (original) +++ ofbiz/trunk/framework/images/webapp/images/selectall.js Fri Nov 5 16:13:00 2010 @@ -410,6 +410,12 @@ function setLookDescription(textFieldId, tooltipElement.update(description); lookupWrapperEl.appendChild(tooltipElement); } + + // after the description is set; the text field may have been updated + // just in case, call onchange again + if ($(textFieldId).onchange != null) { + $(textFieldId).onchange(); + } }
