From: Kiyo W. <ac...@gm...> - 2009-03-20 14:48:44
|
Thank you so much for your help David & Chuck! It worked!! Have a nice weekend, Kiyo On Fri, Mar 20, 2009 at 9:59 AM, David LeBer <dle...@co...>wrote: > > On 20-Mar-09, at 9:27 AM, Kiyo Walker wrote: > > Thanks again Chuck, >> >> Yes, I looked at AjaxExamples. My code is below. Could someone help me >> with what I am doing wrong? Currently, only AutoComplete works. >> >> >> <webobject name="qTypeConsaltationForm"> >> <label class="questionLabel">Consultation Area: >> <div class="formInputText" >> style="width:80px;"> >> <webobject >> name="complexAjaxAutoComplete"></webobject> >> <webobject name = >> "ConsultationUpdater"></webobject> >> </div> >> </label> >> >> <webobject name="updateConsultaion"> >> <label class="questionLabel" >Diagnosis: >> </label> >> <div class="formInputText" >> style="width:80px;"> >> <webobject >> name="diagnosisBrowser"></webobject> >> </div> >> </webobject> >> >> <span><label class="questionLabel">Service: >> </label> >> <div class="formInputText" >> style="width:80px;"> >> <webobject name = >> "serviceBrowser"></webobject> >> </div> >> </span> >> <div style="clear:both"></div> >> <div>Service: <webobject >> name="service"></webobject></div> >> >> </webobject> >> > > > > I use the afterUpdateElement binding on the AjaxAutoComplte. > AjaxAutoComplete does not hava a 'selection' binding like a WOBrowser or > WOPopupButton. The item binding will not return the correct object if the > user selects an object from the autocomplete popdown list. The value binding > will return the correct value though. So in a selectObject method I use the > value to find the appropriate object in my list of available objects. The > side-effect of this is that the displayString needs to return a unique > string for each object. > > I currently do something like this in a reusable component: > > html: > > <wo:AjaxAutoComplete class="to_one_search_field" list="$currentObjects" > value = "$searchValue" item="$item" displayString = "$itemDisplayString" > afterUpdateElement="$searchTermSelectedFunction"/> > <wo name="SearchTermSelected"/> > > wod: > > SearchTermSelected : AjaxSubmitButton { > updateContainerID = ^updateContainerID; // passed in via a binding. > functionName = searchTermSelectedFunctionName; > action= selectObject; > } > > java: (selected methods only) > > public String searchTermSelectedFunctionName() { > if (_safeElementID == null) { > _safeElementID > =ERXStringUtilities.safeIdentifierName(this.context().elementID()); > } > return "oxtorlu_" + _safeElementID + "CompleteFunction"; > } > > public String searchTermSelectedFunction() { > return "function(e) { " + searchTermSelectedFunctionName() + "(); > }"; > } > > public WOActionResults selectObject() { > //find the object and set it. > return null; > } > > ;david > > -- > David LeBer > Codeferous Software > 'co-def-er-ous' adj. Literally 'code-bearing' > site: http://codeferous.com > blog: http://davidleber.net > profile: http://www.linkedin.com/in/davidleber > twitter: http://twitter.com/rebeld > -- > Toronto Area Cocoa / WebObjects developers group: > http://tacow.org > > > > > |