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..
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..
<%= 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] %>
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..
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...
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..
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
u need sheet controllers error message to be displayed in view page of report controller
you 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.
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
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
Alain Ravet Thank you very much
Nice,
Thanks - Tonypm