How cna I pop-up a dialog in a controller


#1

I want to pop-up a warning dialog in a controller. How can I do this?


#2

hi,
Try with alert ()
using java script…

On Tue, Jan 20, 2009 at 11:50 PM, Zhao Yi


#3

raj vuppala wrote:

hi,
Try with alert ()
using java script…

On Tue, Jan 20, 2009 at 11:50 PM, Zhao Yi

I got undefined method alert error in my controller.


#4

def alert(msg)
call ‘alert’ , message
end

check this link
http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper/JavaScriptGenerator/GeneratorMethods.html#M001452

try once…

On Wed, Jan 21, 2009 at 12:12 AM, Zhao Yi


#5

You need to render the javascript call as an output. You can’t call it
inside the controller directly. try this in your controller:

render :update do |page|
page << “alert(‘hello world’);”
end

Regards,

Vincent
vunkyblog.net


#6

oh god…

render :update do |page|
page.alert(‘hello world’)
end


#7

raj vuppala wrote:

def alert(msg)
call ‘alert’ , message
end

check this link
http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper/JavaScriptGenerator/GeneratorMethods.html#M001452

try once…

On Wed, Jan 21, 2009 at 12:12 AM, Zhao Yi

I got this error “undefined method `call’”


#8

alexey.Creopolis wrote:

oh god…

render :update do |page|
page.alert(‘hello world’)
end

I have tried but it shows this message in the page:

try {
alert(“hello world”);
} catch (e) { alert(‘RJS error:\n\n’ + e.toString());
alert(‘alert(“hello world”);’); throw e }