Forum: Ruby on Rails RJS template problem!

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.
Trung T. (Guest)
on 2006-01-29 20:46
hi all,

i have the following controller:

class UserController < ApplicationController
	def login
		@user =[:user])
		@logged_in_user = @user.try_to_login
		if @logged_in_user
			session[:user_id] =
			flash[:notice] = "ung&uuml;ltige Daten!"

with this rjs template:

if @logged_in_user
	page.replace_html 'content', 'welcome!'
	page.replace_html 'nav', :partial => "ascase/navi"
	page.replace_html 'content', :partial => 'loginform'
	page.visual_effect :highlight, 'notice', :duration => 2
	flash[:notice] = ""

and my loginform partial:

<div id="notice"><%= flash[:notice] %></div>
<%= form_remote_tag :url => {:action => 'login'}%>

	<label for="user_nickname">Benutzername</label><br/>
	<%= text_field 'user', 'nickname'  %><br/>
	<label for="user_password">Passwort</label><br/>
	<%= password_field 'user', 'password_plain' %>
  <%= submit_tag "Login" %>
<%= end_form_tag %>

my problem is that i always have to click on the "Login" button twice so
that the "content" and "nav" div are going to replaced.
what can i do to get this with a simple click on "Login" ?

Trung T. (Guest)
on 2006-01-29 23:01
ok, i got it working now.
i have just forgot to give the navi partial an object which is used in
This topic is locked and can not be replied to.