Forum: Ruby on Rails Using RJS to call custom JavaScript class/method

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Jeremy M. (Guest)
on 2006-04-07 00:47
The announcement for RoR 1.1 shows some nice examples of RJS calls. In
particular I am interested in this one:

# Call the custom JavaScript class/method AddressBook.cancel()

In trying to develop a "lightbox" style modal form, I have been
successful in saving the form data via AJAX but I can't seem to close
the "lightbox". I am using the "Lightbox Gone Wild!"
implementation (

How exactly do I call custom JavaScript?

Using 'page.lightbox.deactivate' throws the error: 'RJS error:
ReferenceError: Lightbox is not defined'.

David F. (Guest)
on 2006-04-07 03:29
(Received via mailing list)
Hi Jeremy,

Use this:

page << ';'


-David F.
Peter (Guest)
on 2006-04-07 03:30
page << 'alert("Howdy!");'
Jeremy M. (Guest)
on 2006-04-07 06:38
> Use this:
> page << ';'

Wow. High five. Works like a charm. Thanks a million! :)

Piers (Guest)
on 2006-05-08 14:06
Jeremy M. wrote:
>> Use this:
>> page << ';'
> Wow. High five. Works like a charm. Thanks a million! :)
> -Jeremy

Have a similar problem, but think I may be being thick.

I've a lightbox-style login working (in that the form_remote logs me in
OK), but the window doesn't close and the "You are logged in as ..."
blurb doesn't update.  Any clues where I should put the

page << 'Lightbox.hideall();'

Or do I need to do something different?


This topic is locked and can not be replied to.