Forum: Ruby on Rails First time AJAX and need help

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
B9212f8a8b519c221e9a8760eaf2a586?d=identicon&s=25 petr (Guest)
on 2007-01-12 04:18
I just cant figure why this doesnt work. Im trying to follow a book
example. Well lets see:

<%=form_remote_tag(:update => "text1", :url => {:action => :update})%>
<div class="cap" id="text1"><%=render(:partial => "index_text1")%></div>
<%=end_form_tag%>


the partial contains:

<%=text_area(:page, :text1, :cols => "17", :rows=>
"6")%><br/><%=submit_tag("Save")%>

and the controller:

def index
                @page = Page.find(:first, :conditions => "page =
'index'")
end

def update
                render(:partial => "index_text1")
end


When I click submit, the action changes to update and it renders *only*
the partial and not everything else thats on the page. In other words it
behaves like a non-AJAX form. Can anyone help me with what im doing
wrong?

Thanks,

Petr
5c8d28d1333f8e44641e74c9f72c29c7?d=identicon&s=25 Snow Man (snowman)
on 2007-01-13 19:23
Have you included the necessary javascript libraries in the template?
You should have this line at the top of your index.rhtml (preferably in
the <HEAD> section):

<%= javascript_include_tag :defaults %>
This topic is locked and can not be replied to.