I am trying to make a very simple login page that has light-box like features. The only thing I cannot get to work is the behavior of the actual login button. When you click on it it does nothing. I simply want to submit the info given by the client and redirect either to a private page or make the client log in again. Here is the code for my log in box view:
<tr> <td>User name: <%= text_field("userform", "user_name",:size=>"20" ) %></td><br> <td>Password: <%= password_field("userform", "password",:size=>"20" ) %></td><br> <td> <%= javascript_include_tag :defaults %> <%= submit_tag 'LOG IN', :onclick =>remote_function(:url => {:action => :authenticate, } ) %></td><br> <td><input type='submit' value=' Close me! ' onClick='document.getElementById("loginpopup").style.display = "none"'> </td> </tr> And here is the code from my controller for the authentication action I am calling on: class UserController < ApplicationController def authenticate @user = User.new(params[:userform]) valid_user = User.find(:first,:conditions => ["user_name = ? and password = ? ",@user.user_name, @user.password]) if valid_user session[:user_id]=valid_user.user_name redirect_to :action => 'private' else flash[:notice] = "Invalid User/Password" redirect_to :action=> 'login' end end def login end def private if !session[:user_id] redirect_to :action=> 'login' end end def logout if session[:user_id] reset_session redirect_to :action=> 'login' end end end When I tried typing the code submit_tag 'LOG IN', :onclick =>remote_function(:url => {:action => :authenticate, } ) into irb, I got this error message: NoMethodError: undefined method `remote_function' for main:Object There may be a simple error that I am making, as I am pretty new to the ruby language. Also, if anyone knows another way to do this that will work with the partial rendering I use to display the login box, that would be fine, too. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---