I am using a javascript to redirect to another action. Is there a way to set the flash [:notice] in the javascript? So when the javascript redirects, the new action/view picks up the flash[:notice]? (I suspect I may have to do something like url?notice=.....) ideas? thanks.
On Wed, May 13, 2009 at 10:33 PM, nextpulse <robert-pZCIFDiVgMdl57MIdRCFDg@public.gmane.org> wrote:> > I am using a javascript to redirect to another action. Is there a way > to set the flash [:notice] in the javascript? > > So when the javascript redirects, the new action/view picks up the > flash[:notice]? > > (I suspect I may have to do something like url?notice=.....) > > ideas? > > thanks.I don''t think there is a way but you can use a parameter like notice=Flash%20message and then in the receiving action do flash.now[:notice] = params[:notice] if params[:notice] Andrew Timberlake http://ramblingsonrails.com http://www.linkedin.com/in/andrewtimberlake "I have never let my schooling interfere with my education" - Mark Twain
I think it would be awkward to call a URL just to add a flash notice to the site. Do it in JS only, and "simulate" the flash notice, by showing it using pure clientside javascript. Like: document.getElementById("myEmptyFlashNoticeDiv).innerHTML = "my notice" -- Posted via http://www.ruby-forum.com/.
@Chris: I think you mis-understood me. I am redirecting to another URL - not to set flash. I would like to keep the context of flash notices that was set - so the redirected url picks it up. @ Andrew: thanks - its a similar approach I was thinking of. Thought there may be a less ''clunky'' way. On May 14, 1:06 am, "Chris B." <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I think it would be awkward to call a URL just to add aflashnotice to > the site. > Do it in JS only, and "simulate" theflashnotice, by showing it using > pure clientside javascript. > > Like: document.getElementById("myEmptyFlashNoticeDiv).innerHTML = "my > notice" > -- > Posted viahttp://www.ruby-forum.com/.
On Thu, May 14, 2009 at 12:34 PM, nextpulse <robert-pZCIFDiVgMdl57MIdRCFDg@public.gmane.org> wrote:> > @Chris: I think you mis-understood me. I am redirecting to another URL > - not to set flash. I would like to keep the context of flash notices > that was set - so the redirected url picks it up. > > @ Andrew: thanks - its a similar approach I was thinking of. Thought > there may be a less ''clunky'' way. > > > On May 14, 1:06 am, "Chris B." <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: > > I think it would be awkward to call a URL just to add aflashnotice to > > the site. > > Do it in JS only, and "simulate" theflashnotice, by showing it using > > pure clientside javascript. > > > > Like: document.getElementById("myEmptyFlashNoticeDiv).innerHTML = "my > > notice" > > -- > > Posted viahttp://www.ruby-forum.com/.What''s the purpose of the flash notice being transferred/available to the other pages? -Conrad --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---