# Combining Erb and RJS

**URL:** <https://www.ruby-forum.com/t/combining-erb-and-rjs/88675>\
**Category:** Rails\
**Created:** [March 13, 2007, 1:54pm UTC](https://www.ruby-forum.com/t/combining-erb-and-rjs/88675 "2007-03-13T13:54:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![KSRajesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/c77e96/32.png) [@KSRajesh](https://www.ruby-forum.com/u/KSRajesh)\
**Post date:** [March 13, 2007, 1:54pm UTC](https://www.ruby-forum.com/t/combining-erb-and-rjs/88675/1 "2007-03-13T13:54:08Z")

</div>

Heres the thing. I want to render a page with standard .rhtml and I  
want to do some RJS style effects on the same page.

Inline RJS doesnt work. I cant do a  
render :rjs

Obviously I know it can be done… simple example of what I want to do  
is what basecamp does… on adding a message, it does a visual\_effect  
on the new message.

What am I missing?

Rajesh

---

<div class="post-metadata">

**Author:** ![KSRajesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/c77e96/32.png) [@KSRajesh](https://www.ruby-forum.com/u/KSRajesh)\
**Post date:** [March 13, 2007, 2:36pm UTC](https://www.ruby-forum.com/t/combining-erb-and-rjs/88675/2 "2007-03-13T14:36:17Z")

</div>

On Mar 13, 12:53 pm, “K. Rajesh” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Heres the thing. I want to render a page with standard .rhtml and I  
> want to do some RJS style effects on the same page.
> 
> Inline RJS doesnt work. I cant do a  
> render :rjs

You can use the Scriptaculous helpers:

[http://api.rubyonrails.com/classes/ActionView/Helpers/ScriptaculousHelper.html](http://api.rubyonrails.com/classes/ActionView/Helpers/ScriptaculousHelper.html)

to put raw JavaScript for visual effects straight into your RHTML  
templates:

\<%= visual\_effect(…) %\>

You’ll want to wrap this code in tags, or put it  
in an onload, or something like that.

Chris

---

<div class="post-metadata">

**Author:** ![KSRajesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/c77e96/32.png) [@KSRajesh](https://www.ruby-forum.com/u/KSRajesh)\
**Post date:** [March 13, 2007, 6:17pm UTC](https://www.ruby-forum.com/t/combining-erb-and-rjs/88675/3 "2007-03-13T18:17:04Z")

</div>

Thanks Chris… peach.

Rajesh
