Hello RoR Developers, I was wondering that can we send warning message like "alert" from controller. can I write something like flash[:message]="message" alert(<%flash[:message]%>) warn.message("or something like this"). 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-/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 -~----------~----~----~----~------~----~------~--~---
<%= flash[:error] %> this alone will do... no need for warn or alert....... alert will not work.... In controller under respond to assign value to flash[:notice] like flash[:notice] = ''Successfully created.'' and in views get that displayed as <%= flash[:notice] %> -- 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 -~----------~----~----~----~------~----~------~--~---
Ratnavel Sundaramurthi wrote:> > > <%= flash[:error] %> > this alone will do... > no need for warn or alert....... > > alert will not work.... > > In controller under respond to assign value to flash[:notice] like > flash[:notice] = ''Successfully created.'' > > and in views get that displayed as <%= flash[:notice] %>Ok. I will try again. Last time I couldn t use it. Anyway I will write if I have problem with it. thank you very much.. -- 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 -~----------~----~----~----~------~----~------~--~---
> Ok. I will try again. Last time I couldn t use it. Anyway I will write > if I have problem with it. > > thank you very much..K all the best... -- 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 -~----------~----~----~----~------~----~------~--~---
> K all the best...hmmm Ratnavel Sundaramurthi I think I make mistake but when I try flash[:notice] = ''Successfully created.'' <%= flash[:notice] %> it s written like normal line. do you know another way to do it. sending warning message to user from controller. actually I have another question about it. while I have two controllers (report and sheet(view page)) how can I call this warning message from other controller. I mean view page belong to sheet controller, I want to send this error message from report controller. thanks again and again.. -- 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 -~----------~----~----~----~------~----~------~--~---
> flash[:notice] = ''Successfully created.'' > <%= flash[:notice] %>Message will be active in the flash[:notice] until it is implicitely made nil. I never tried doing it.... Anyway, Yr question is this rite.. u have flash[:notice] in both yr sheet controller and report controller.... u need sheet controllers error message to be displayed in view page of report controller -- 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 -~----------~----~----~----~------~----~------~--~---
> u need sheet controllers error message to be displayed in view page of > report controlleryou got misunderstanding, report controller has no view page, all controllers use one, some of methods are kept in report controller,anyway you don t need all information, Basically, my problem is that can not send warning message even from sheet controller(view page controller). pop up windows or another way I don t know how to send message without refreshing page.. I know but couldnt. -- 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 -~----------~----~----~----~------~----~------~--~---
On Thu, Mar 6, 2008 at 6:04 PM, Lamer Lamer <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Basically, my problem is that can not send warning message even from > sheet controller(view page controller). > pop up windows or another way I don t know how to send message without > refreshing page.. I know but couldnt.You can''t send it without refreshing the page unless your site uses AJAX or some basic Javascript. One way is have a periodic call to your server, if something comes back, display it. You''ll have to research that out a bit. Regards Mikel --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
how about flash, flash[:error]="error message" <%=flash[:error]%> I tried it but written like normal line. is it suitable for this situation, and another question if we assume that the page can be refreshed, how can we send message like alert in javascript. thanks Mikel,, -- 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 -~----------~----~----~----~------~----~------~--~---
> I was wondering that can we send warning message like "alert" from> controller. In the controller : flash[:alert] = "a message to the user ..." In the layout (or view) : ... <% if flash[:alert] %> <script type="text/javascript" charset="utf-8"> document.observe("dom:loaded", function(){ alert(''<%= flash[:aler] %>} ); </script> <% end -%> </head> I use this trick to make redirect_to ... , :anchor => ''error'' work with IE : In the controller : flash[:scroll_to_for_ie] = ''an_error'' redirect_to url_for( ..., :anchor =>''an_error'') In the layout : ... <% if flash[:scroll_to_for_ie] %> <script type="text/javascript" charset="utf-8"> document.observe("dom:loaded", function(){ if(Prototype.Browser.IE){$(''<%flash[:scroll_to_for_ie] %>'').scrollTo();} } ); </script> <% end -%> </head> ... Alain --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Alain Ravet Thank you very much -- 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 -~----------~----~----~----~------~----~------~--~---
Nice, Thanks - Tonypm --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---