How cna I pop-up a dialog in a controller

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

hi,
Try with alert ()
using java script…

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

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.

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

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

oh god…

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

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’”

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 }