views:

45

answers:

1

Hi, I got a weird problem, here is the snippet of my code,

View 1:

 <%= javascript_include_tag :defaults %>
 <% remote_form_for (@group, :group, :url => { :action => 'addgroup' }, :update => 'activitypage') do |form| %>

<%= submit_tag "Add!", :class => "submit" %>  
<% end %>

Method 'addgroup',

   def addgroup
    ##<some code here>
    render :update do |page|
    page.replace_html ('activitypage', :partial => 'vindex')
    page[:activitypage].visual_effect :highlight
    return

View 2, _vindex.html_erb

<h1>Group</h1>

<%= javascript_include_tag :defaults %>

I got here

The browser displayed the javascript code as below instead of the html content,

try { Element.update("activitypage", ""); $("activitypage").visualEffect("highlight");....

What is the possible wrong in the code above? Thanks,

A: 

Is your partial view named '_vindex.html_erb'? Have you tried renaming it to '_vindex.html.erb' - Rails may not be treating it as HTML (or as an ERB file, for that matter) - which may be the cause of your issue.

theTRON
it is a typo. The actually filename is _vindex.html.erb.
erwin