Thanks, but that is completely over my head at this point. I am not even perfectly clear on what "X = $(this)" means or why "var x = this" is needed here.
Mark Thompson On Jan 14, 1:56 pm, "Diego A." <[EMAIL PROTECTED]> wrote: > I work around the same issues with several other plugins as well... > I'll explain how I solve it, maybe that will help others with the same > problem. > > * I add my own 'layer' to the initialization of the plugin. * > > Instead of... > $('input.autocomplete').autocomplete({ /* options */ }); > > I do this... > $('input.autocomplete').each(function(){ > var x = this, X = $(this); > // do stuff... > X.autocomplete({ > callback: function(event, data, formatted){ > // do stuff... > X.change(); > } > }); > > }); > > My 'layer' gets a little more complicated because I implement my own > integration methods using the metadata plugin, but this should give > you an idea of how to get started... > > On Jan 14, 6:24 pm, dustyt <[EMAIL PROTECTED]> wrote: > > > Thanks for the input, Sheldon. > > > What you have said sounds logical, but I think that I may be > > experiencing a different problem because what I am referring to is > > when something is selected in the dropdown (which puts the selected > > value into the input box) and then the input loses focus, onchange > > apparently does not fire. I would think that this lack of firing > > should not be the default case, so that it would mirror the behavior > > of a select box, or, at least, that the default could be readily > > overridden or that some other event could be tied to in order to have > > similar behavior to a select box. > > > Also, I would prefer to have the updatePartyAddress function called > > only when the input loses focus and has changed its value and > > therefore do not much like the idea of tying the updatePartyAddress > > function to onkeyup. > > > I can possibly see how to correctly call the updatePartyAddress > > function directly if theautocompletefunction selectItem() is called > > when an item is selected in anautocompletedropdown and onItemSelect > > points to a function that I can have call updatePartyAddress and I > > have a reference to the particular input box that has had its value > > selected. So far, though, I do not know how to programmatically refer > > to the input box that has had its value changed so that I can call > > updatePartyAddress with a reference to this input box (and with a > > value that now has to be extracted from its name but that was directly > > written into the previously used onchange JavaScript function--unless > > I can call the onchange function directly). > > > Mark Thompson > > > On Jan 11, 1:40 pm, Sheldon Griffin <[EMAIL PROTECTED]> wrote: > > > > Keep in mind that the onchange event for a text input box is only > > > fired when the input loses focus. Tying your updatePartyAddress > > > function to onkeyup instead of onchange is one way to get it to fire > > > after every letter. > > > > That being said, it should be firing if you type in some letters and > > > click on the page outside the box - if it's still not firing in that > > > situation, it's a different problem. > > > > Sheldon Griffin > > > > On Jan 10, 1:16 pm, dustyt <[EMAIL PROTECTED]> wrote: > > > > > I am trying to replace a previous bit of html that managed input by > > > > both an input and a select box with a single input field using > > > > jquery.autocomplete.js, but I have not been able to getautocomplete > > > > to use the onchange JavaScript code used by that previous bit of html. > > > > I have gottenautocompleteto display and select all the values > > > > correctly in multiple analogous fields on the same form, but I do not > > > > know how to have it trigger the code that was previously run under an > > > > onchange event. Unfortunately, I do not understand much of the jquery > > > > andautocompletecode, and I am only moderately more familiar with > > > > JavaScript. > > > > > I am sorry if this is somewhat of a duplicate message. I posted a > > > > message last night under the same nickname, dustyt, but from a > > > > different account, [EMAIL PROTECTED] I cannot now access the > > > > group from this account (I can read messages--although I do not see my > > > > posting from last night--but the group wants me to join before > > > > posting, yet I am already a member) due to some weirdness with Google > > > > and signing in. When I joined the group last night, it gave me access > > > > to the Members, but now says that I must be a manager to do so or that > > > > jquery_en is not a group. More weirdness. > > > > > Here is a bit of the current relevant code: > > > > <input class="text" id="city<%=addID%>" type="text" > > > > name="city<%=addID%>" size="30" maxlength="120" value="<c:out value="$ > > > > {partyAddress.city}"/>" onchange="javascript: updatePartyAddress(this, > > > > <%=addID%>);" > > > > > ... > > > > var idList = "<%=addIDStringBuffer.toString()%>"; > > > > var idArray = idList.split(","); > > > > > $(document).ready(function() { > > > > for(var i=0; i< idArray.length; i++) { > > > > $("#city"+idArray[i]).autocompleteArray( > > > > [ > > > > <%=cityList.toString()%> > > > > ], > > > > { > > > > delay:10, > > > > minChars:1, > > > > matchSubset:1, > > > > onItemSelect:selectItem, > > > > onFindValue:findValue, > > > > autoFill:true, > > > > maxItemsToShow:10 > > > > } > > > > ); > > > > } > > > > > }); > > > > > Perhaps something to do with selectItem is needed? > > > > Any help would be appreciated. Thanks. > > > > > Mark R. Thompson