Hi,everyone
I almost give up in this problem.I simply want to flash a notice at the
bottom of the page when add_place is done.
in my view,i have
 <%= start_form_tag({:action => "add_place"}) %>
      ...
        ...
    <%= submit_tag(''Add Place'') %> or <%= cancel
%>
   <%= end_form_tag %>
  <div id ="my_notice"></div>
I have a method in the controller
def add_place
...
...
render :action=>"flash_notice"
end
I want to display a flashed notice "place is saved in the database" at
the end of the method.
and flash_notice.rjs is like
page.insert_html :bottom,''my_notice'',
:partial=>''add_place''
page.visual_effect :highlight, ''my_notice''
_add_place.rhtml
<%= flash[:notice] = ''Place was successfully saved'' %>
when I do this, the page refreshes, instead of doing the right thing,
the page simply displays my code.
new Insertion.Bottom("my_notice", "Place was successfully
saved");
new Effect.Highlight("my_notice",{});
anybody has some ideas?
greatly appreciated for any help!
-- 
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-/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
-~----------~----~----~----~------~----~------~--~---
Jacquie, Use form_remote_tag instead. form_tag fires a regular POST requests, and the browser is correctly displaying the results. If you want an AJAX call (as you do), use form_remote_tag instead of start_form_tag. Make sure you check the API docs (api.rubyonrails.org) because the parameters for form_remote_tag are slightly different than form_tag. Matt On 12/6/06, jacquie <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > Hi,everyone > > I almost give up in this problem.I simply want to flash a notice at the > bottom of the page when add_place is done. > > in my view,i have > <%= start_form_tag({:action => "add_place"}) %> > ... > ... > <%= submit_tag(''Add Place'') %> or <%= cancel %> > <%= end_form_tag %> > <div id ="my_notice"></div> > > I have a method in the controller > > def add_place > ... > ... > render :action=>"flash_notice" > end > > I want to display a flashed notice "place is saved in the database" at > the end of the method. > > and flash_notice.rjs is like > > page.insert_html :bottom,''my_notice'', :partial=>''add_place'' > page.visual_effect :highlight, ''my_notice'' > > _add_place.rhtml > > <%= flash[:notice] = ''Place was successfully saved'' %> > > when I do this, the page refreshes, instead of doing the right thing, > the page simply displays my code. > > new Insertion.Bottom("my_notice", "Place was successfully saved"); > new Effect.Highlight("my_notice",{}); > > anybody has some ideas? > greatly appreciated for any help! > > -- > Posted via http://www.ruby-forum.com/. > > > >-- Matt White ----------------------- Thermal Creative http://blog.thermalcreative.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 -~----------~----~----~----~------~----~------~--~---
Geez. Thanks so much, Matt. I''ve changed start_form_tag to form_remote_tag, and it works straight away!!! Matt White wrote:> Jacquie, > > Use form_remote_tag instead. form_tag fires a regular POST requests, and > the > browser is correctly displaying the results. If you want an AJAX call > (as > you do), use form_remote_tag instead of start_form_tag. > > Make sure you check the API docs (api.rubyonrails.org) because the > parameters for form_remote_tag are slightly different than form_tag. > > Matt > > On 12/6/06, jacquie <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >> ... >> end >> >> >> -- >> Posted via http://www.ruby-forum.com/. >> >> > >> > > > -- > Matt White > ----------------------- > Thermal Creative > http://blog.thermalcreative.com-- 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-/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 -~----------~----~----~----~------~----~------~--~---
No problem... I like the easy ones ;) On 12/7/06, jacquie <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > Geez. Thanks so much, Matt. > > I''ve changed start_form_tag to form_remote_tag, and it works straight > away!!! > > Matt White wrote: > > Jacquie, > > > > Use form_remote_tag instead. form_tag fires a regular POST requests, and > > the > > browser is correctly displaying the results. If you want an AJAX call > > (as > > you do), use form_remote_tag instead of start_form_tag. > > > > Make sure you check the API docs (api.rubyonrails.org) because the > > parameters for form_remote_tag are slightly different than form_tag. > > > > Matt > > > > On 12/6/06, jacquie <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > >> ... > >> end > >> > >> > >> -- > >> Posted via http://www.ruby-forum.com/. > >> > >> > > >> > > > > > > -- > > Matt White > > ----------------------- > > Thermal Creative > > http://blog.thermalcreative.com > > > -- > Posted via http://www.ruby-forum.com/. > > > >-- Matt White ----------------------- Thermal Creative http://blog.thermalcreative.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 -~----------~----~----~----~------~----~------~--~---