Hello I would like to be able to do/reuse the autocompleter for the following thing. The field opened for autocompletion in my HTML form, will not based in my ActiveRecord (RoR), but declared as a new attribute like this: attr_accessor :name_search In this model class, i have an id (let''s say user_id that is ''based'' i.e when i persist into in database, i save this user_id but not the name_search) mapped to the correspomding column from the table. So with the Autocompleter (that i should extend i think), i would like to : Open the search on the ''name_search'' field, choose name in the list (i should find a means to have the user_id hidden in a div at each line), then : - set this name in the ''name_search'' field - set the corresponding user_id in an hidden field. When clicking OK, i send the user_id information for saving... Had anyone already this kind of behaviour. Laurent --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
In fact after some thinks , i could : render XML or JSON from my controller, in order to send back user_ids and names to populate the drop down list. Modify the function callback , which receives the response as XML/JSON for parsing and repainting the drop down list. Each row in the dropdown list s enclosed by a a href with onclick event, calling a function(with current user_id as argument) setting the value in the Hidden field What do you think of? L On 2 mai, 22:15, Laurent <laurent.b...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello > > I would like to be able to do/reuse the autocompleter for the > following thing. > > The field opened for autocompletion in my HTML form, will not based in > my ActiveRecord (RoR), but declared as a new attribute like this: > > attr_accessor :name_search > > In this model class, i have an id (let''s say user_id that is ''based'' > i.e when i persist into in database, i save this user_id but not the > name_search) mapped to the correspomding column from the table. > > So with the Autocompleter (that i should extend i think), i would like > to : > Open the search on the ''name_search'' field, choose name in the list (i > should find a means to have the user_id hidden in a div at each line), > then : > - set this name in the ''name_search'' field > - set the corresponding user_id in an hidden field. > When clicking OK, i send the user_id information for saving... > > Had anyone already this kind of behaviour. > > Laurent--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On May 2, 2007, at 10:15 PM, Laurent wrote:> I would like to be able to do/reuse the autocompleter for the > following thing. > > The field opened for autocompletion in my HTML form, will not based in > my ActiveRecord (RoR), but declared as a new attribute like this: > > attr_accessor :name_search > > In this model class, i have an id (let''s say user_id that is ''based'' > i.e when i persist into in database, i save this user_id but not the > name_search) mapped to the correspomding column from the table. > > So with the Autocompleter (that i should extend i think), i would like > to : > Open the search on the ''name_search'' field, choose name in the list (i > should find a means to have the user_id hidden in a div at each line), > then : > - set this name in the ''name_search'' field > - set the corresponding user_id in an hidden field. > When clicking OK, i send the user_id information for saving...That''s provided by model_auto_completer: http://agilewebdevelopment.com/plugins/model_auto_completer -- fxn --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
thanks xavier..it''s exactly what i need l On 3 mai, 08:47, Xavier Noria <f...-xlncskNFVEJBDgjK7y7TUQ@public.gmane.org> wrote:> On May 2, 2007, at 10:15 PM, Laurent wrote: > > > > > I would like to be able to do/reuse the autocompleter for the > > following thing. > > > The field opened for autocompletion in my HTML form, will not based in > > my ActiveRecord (RoR), but declared as a new attribute like this: > > > attr_accessor :name_search > > > In this model class, i have an id (let''s say user_id that is ''based'' > > i.e when i persist into in database, i save this user_id but not the > > name_search) mapped to the correspomding column from the table. > > > So with the Autocompleter (that i should extend i think), i would like > > to : > > Open the search on the ''name_search'' field, choose name in the list (i > > should find a means to have the user_id hidden in a div at each line), > > then : > > - set this name in the ''name_search'' field > > - set the corresponding user_id in an hidden field. > > When clicking OK, i send the user_id information for saving... > > That''s provided by model_auto_completer: > > http://agilewebdevelopment.com/plugins/model_auto_completer > > -- fxn--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
In the case where they type a name and do not select from the list then the text box is populated but no id is populated. Is there a good way to insure a selection is made? Deco On May 3, 2007, at 4:59 AM, Laurent wrote:> > thanks xavier..it''s exactly what i need > > l > > On 3 mai, 08:47, Xavier Noria <f...-xlncskNFVEJBDgjK7y7TUQ@public.gmane.org> wrote: >> On May 2, 2007, at 10:15 PM, Laurent wrote: >> >> >> >>> I would like to be able to do/reuse the autocompleter for the >>> following thing. >> >>> The field opened for autocompletion in my HTML form, will not >>> based in >>> my ActiveRecord (RoR), but declared as a new attribute like this: >> >>> attr_accessor :name_search >> >>> In this model class, i have an id (let''s say user_id that is ''based'' >>> i.e when i persist into in database, i save this user_id but not the >>> name_search) mapped to the correspomding column from the table. >> >>> So with the Autocompleter (that i should extend i think), i would >>> like >>> to : >>> Open the search on the ''name_search'' field, choose name in the >>> list (i >>> should find a means to have the user_id hidden in a div at each >>> line), >>> then : >>> - set this name in the ''name_search'' field >>> - set the corresponding user_id in an hidden field. >>> When clicking OK, i send the user_id information for saving... >> >> That''s provided by model_auto_completer: >> >> http://agilewebdevelopment.com/plugins/model_auto_completer >> >> -- fxn > > > >--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On May 3, 2007, at 1:09 PM, Deco Rior wrote:> In the case where they type a name and do not select from the list > then the text box is populated but no id is populated. Is there a > good way to insure a selection is made?The plugin by default prevents this. If the user edits the textfield the ID is untouched, and the string is restored at onblur to the last selected completion. Hopefully the user sees the rollback and notices his edition had no effect. I am not particularly satisfied with this behaviour, but it was the best solution I could think of, because the textfield needs to be editable so that the user can enter text to be completed. On the other hand, if :allow_free_text is true then editions are allowed and monitored, if there''s free text the ID becomes the empty string. This is documented at the bottom of http://model-ac.rubyforge.org/classes/ModelAutoCompleterHelper.html -- fxn --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Another question... Now this plugin will save me some time for one of my screens, i planned to Mix a : InPlaceEditor with AutoCompleter... Having a displayed field, by simple CLik it will repaint a form including the textField. For this TextField, i want have the live search ..simple AutoCompleter, and another version with the Model_AutoCompleter. Does it seem you possible to mix the two....most of the work will be some Javascript hacking, by extending the InPlaceEditor: I should redraw form, textfield, hidden field, and the piece of code to bind the AutoCompleter L --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On May 3, 2007, at 1:47 PM, Laurent wrote:> Another question... > Now this plugin will save me some time for one of my screens, i > planned to Mix a : > InPlaceEditor with AutoCompleter... > Having a displayed field, by simple CLik it will repaint a form > including the textField. > For this TextField, i want have the live search ..simple > AutoCompleter, and another version with the Model_AutoCompleter. > > Does it seem you possible to mix the two....most of the work will be > some Javascript hacking, by extending the InPlaceEditor: > I should redraw form, textfield, hidden field, and the piece of code > to bind the AutoCompleterPerhaps it could as easy as wrapping the form in an adhoc container like a DIV, and adapt the code to generate and toggle that container. -- fxn --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Finally i did my InPlacePartialEditor..but i keep your suggestion for further needs: For more complex forms , that we need to display with preloaded data (Edition mode) , preparing this form in advance in the page will be more performant when toggling to make it appear Laurent On 3 mai, 14:17, Xavier Noria <f...-xlncskNFVEJBDgjK7y7TUQ@public.gmane.org> wrote:> On May 3, 2007, at 1:47 PM, Laurent wrote: > > > Another question... > > Now this plugin will save me some time for one of my screens, i > > planned to Mix a : > > InPlaceEditor with AutoCompleter... > > Having a displayed field, by simple CLik it will repaint a form > > including the textField. > > For this TextField, i want have the live search ..simple > > AutoCompleter, and another version with the Model_AutoCompleter. > > > Does it seem you possible to mix the two....most of the work will be > > some Javascript hacking, by extending the InPlaceEditor: > > I should redraw form, textfield, hidden field, and the piece of code > > to bind the AutoCompleter > > Perhaps it could as easy as wrapping the form in an adhoc container > like a DIV, and adapt the code to generate and toggle that container. > > -- fxn--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---