I wrote a small helper which receive a parameter "f", as following: def cno_helper(f) concat "<INPUT id=''" + f + "'' size=''13'' type=''text'' />" concat "<div class=''auto_complete'' id=''" + f + "_auto_complete''" concat "style=''display:none;border:none;background-color:white;height:150px;overflow:none;cellpadding:0;cellspacing:0''>" concat "</div>" concat auto_complete_field( f, :frequency => 0.4, :min_chars => 2, :method => ''GET'', :url=>{:action=>''autocomplete_vc_cno''}, :tokens => '','') end It generate the code I want, and the auto_complete_field is working. The program is I don''t know how to pass the current value of the input field to the :action ''autocomplete_vc_cno''. Any idea? Thanks in advance. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
You can send it as a :with param. concat auto_complete_field( f,> :frequency => 0.4, > :min_chars => 2, > :method => ''GET'', > :url=>{:action=>''autocomplete_vc_cno''}, :with => " ''val='' + this.value ", > :tokens => '','') > endOn Jan 25, 10:55 am, Mc Ieong <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I wrote a small helper which receive a parameter "f", as following: > > def cno_helper(f) > concat "<INPUT id=''" + f + "'' size=''13'' type=''text'' />" > concat "<div class=''auto_complete'' id=''" + f + "_auto_complete''" > concat > "style=''display:none;border:none;background-color:white;height:150px;overflow:none;cellpadding:0;cellspacing:0''>" > concat "</div>" > > concat auto_complete_field( f, > :frequency => 0.4, > :min_chars => 2, > :method => ''GET'', > :url=>{:action=>''autocomplete_vc_cno''}, > :tokens => '','') > end > > It generate the code I want, and the auto_complete_field is working. > The program is I don''t know how to pass the current value of the input > field to the :action ''autocomplete_vc_cno''. > > Any idea? Thanks in advance. > -- > Posted viahttp://www.ruby-forum.com/.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Chris Habgood wrote:> You can send it as a :with param. > > concat auto_complete_field( f, >> :frequency => 0.4, >> :min_chars => 2, >> :method => ''GET'', >> :url=>{:action=>''autocomplete_vc_cno''}, :with => " ''val='' + this.value ", >> :tokens => '','') >> endThanks a lot! -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Mc Ieong wrote:> Chris Habgood wrote: >> You can send it as a :with param. >> >> concat auto_complete_field( f, >>> :frequency => 0.4, >>> :min_chars => 2, >>> :method => ''GET'', >>> :url=>{:action=>''autocomplete_vc_cno''}, :with => " ''val='' + this.value ", >>> :tokens => '','') >>> end > > Thanks a lot!It should be: concat auto_complete_field( f, :frequency => 0.4, :min_chars => 2, :method => ''GET'', :url=>{:action=>''autocomplete_vc_cno''}, :with => " ''val='' + document.getElementById(''" + f + "'').value ", :tokens => '','') Thanks! -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.