Ok, I have manny divs in the html, and I have a login form in a inner
div, if the user tries to login and the user/password is invalid, only
the inner div needs to be refreshed and show the user the error. If the
user/password is ok, the main div needs to be refreshed.
How could I do this?
this is the view in example
<div id="MainDiv">
foo
<div id="InnerDiv">
<%= form_tag :action => "login" %>
<%= text_field "user", "username", "size"
=> "20", "class" =>
"Textos-02" %>
<%= text_field "user", "password", "size"
=> "20", "class" =>
"Textos-02" %>
<%= image_submit_tag "bot-ok.gif" %>
<% end_form_tag %>
</div>
</div>
and this is the controller
class HomePageController < ApplicationController
def login
#More than 2 parameters means an post (there is always a post couse
it''s ajax)
if params.length == 2
@user = User.new
else
if @user.username == "foo" && @user.password ==
"foo"
logger.warn "loggin failed, refresh only InnerDiv and show the
error"
else
logger.warn "loggin failed, refresh MainDiv"
end
end
#Show the page
@headers["Content-Type"] = "text/html;
charset=ISO8859-1"
render :layout => false
end
end
Rodrigo Dominguez
Iplan Networks Datos Personales
rdominguez@iplan.com.ar rorra@rorra.com.ar
www.iplan.com.ar <http://www.iplan.com.ar/>
www.rorra.com.ar <http://www.rorra.com.ar/>
5031-6303 15-5695-6027
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://wrath.rubyonrails.org/pipermail/rails/attachments/20060328/458470d6/attachment-0001.html