If anyone is interested, I uploaded the files for this on the files section of this group. dtcontrols.js has the SelectAutocompleter.Base and Ajax.SelectAutocompleter objects and application_helper.rb has the Rails helper macro. The usage is similar to Autocompleter except it pops up a select element instead of UL. You can pass a value in each option of the select element in your AJAX action. It has 2 more options: one called valueElement is the id of a text or hidden field in your page to receive the value corresponding to the text selected in the listbox. one is called redirect_url, if it is assigned the page is redirected to this url upon selection of an option.You can pass the string '??' in this url, it will be replaced with the value selected, this allows redirection by id on a lookup field.
It works for the most part with IE6 and Firefox 2, any comments or bug reports are welcome. On Dec 7, 9:38 am, "Mushing Fan" <[EMAIL PROTECTED]> wrote: > I would need to use an AJAX lookup list box, to return an id, based on > a lookup field. > It would be similar to the autocomplete control, but rendering a select > element instead of a UL, and returning the id associated with the > selected text. > The select element is nice for that because the id is stored in the > value attribute of each option and it has built in scrolling in case > there are many options returned. > Is there anything like this already available? > In case I have to write my own my path would be I guess: > > - Derive a js object from Autocompleter.Base, overriding the methods > like onKeyPress... > - Derive an Ajax object from it > - Write a helper to use it in rails > Any suggestions are welcome --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
