This code below will display "Search Friends" in the text box IF {:select => ''friend''} is not there and the ajax call also does not work. Any ideas how to get the text and to disaply and have the ajax call work? <%= text_field_with_auto_complete :friend, :name,{:select => ''friend''}, :value => "Search Friends", :onfocus => "if (this.value =''Search Friends'') {this.value = '''';}",:onblur => "if (this.value ='''') {this.value = ''Search Friends'';}", :after_update_element => "function(element,value){" + remote_function(:url => { :controller => ''followerranking'', :action => :ajax_add_friend }, :with => "''friend[name]='' + element.value") + "}" %>
On Sep 30, 11:05 am, Me <chabg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> This code below will display "Search Friends" in the text box IF > {:select => ''friend''} is not there and the ajax call also does not > work. Any ideas how to get the text and to disaply and have the ajax > call work? > > <%= text_field_with_auto_complete :friend, :name,{:select => > ''friend''}, :value => "Search Friends", :onfocus => "if (this.value => ''Search Friends'') {this.value = '''';}",:onblur => "if (this.value => '''') {this.value = ''Search Friends'';}", > :after_update_element => "function(element,value){" + > remote_function(:url => { :controller => ''followerranking'', :action > => :ajax_add_friend }, > :with => "''friend[name]='' + element.value") + "}" %>What do you mean by "not work"? Check your rails log and see if a request is hitting your app at all. Did you include something like <%= javascript_include_tag :defaults %> in your layout or view? Jeff purpleworkshops.com
No. If the "select" statement is in there the ajax :after_update works with the :value=>"". If it is not then the text displays in the text box for :value=>"", but the :after_update does not work. On Wed, Sep 30, 2009 at 1:00 PM, Jeff <cohen.jeff-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > On Sep 30, 11:05 am, Me <chabg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > This code below will display "Search Friends" in the text box IF > > {:select => ''friend''} is not there and the ajax call also does not > > work. Any ideas how to get the text and to disaply and have the ajax > > call work? > > > > <%= text_field_with_auto_complete :friend, :name,{:select => > > ''friend''}, :value => "Search Friends", :onfocus => "if (this.value => > ''Search Friends'') {this.value = '''';}",:onblur => "if (this.value => > '''') {this.value = ''Search Friends'';}", > > :after_update_element => > "function(element,value){" + > > remote_function(:url => { :controller => ''followerranking'', :action > > => :ajax_add_friend }, > > :with => "''friend[name]='' + > element.value") + "}" %> > > What do you mean by "not work"? Check your rails log and see if a > request is hitting your app at all. > > Did you include something like <%= javascript_include_tag :defaults %> > in your layout or view? > > Jeff > purpleworkshops.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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
anybody? On Sep 30, 1:00 pm, Jeff <cohen.j...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Sep 30, 11:05 am, Me <chabg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > This code below will display "Search Friends" in the text box IF > > {:select => ''friend''} is not there and the ajax call also does not > > work. Any ideas how to get the text and to disaply and have the ajax > > call work? > > > <%=text_field_with_auto_complete:friend, :name,{:select => > > ''friend''}, :value => "Search Friends", :onfocus => "if (this.value => > ''Search Friends'') {this.value = '''';}",:onblur => "if (this.value => > '''') {this.value = ''Search Friends'';}", > > :after_update_element => "function(element,value){" + > > remote_function(:url => { :controller => ''followerranking'', :action > > => :ajax_add_friend }, > > :with => "''friend[name]='' + element.value") + "}" %> > > What do you mean by "not work"? Check your rails log and see if a > request is hitting your app at all. > > Did you include something like <%= javascript_include_tag :defaults %> > in your layout or view? > > Jeff > purpleworkshops.com