EXTJS With Rails.. render partials into divs

Ok so I have been playing with extjs and rails for about a week and I
feel I have made good progress. But I have gotten stuck. I have an
extjs form that has a button that submits data to my login method. I
want to have the controller update just a div in my page without
reloading or redirecting the page. This works great if I use just an
normal ruby on rails link_to. However, when I use a extjs button and
set the handler to call the controller the controller cannot render a
partial. It just hangs.

So here is my exmple. I have a very simple forum:

[CODE] var simple = new Ext.FormPanel({
labelWidth: 75, // label settings here cascade unless
title: ‘Sign In’,
bodyStyle:‘padding:5px 5px 0’,
width: 350,
defaults: {width: 230},
defaultType: ‘textfield’,

    items: [{
            fieldLabel: 'Screen Name',
            name: 'screen_name',
          fieldLabel: 'Password',
          name: 'password'

    buttons: [{
        text: 'Login',
        type: 'submit',
        handler: function(){
        simple.form.submit({url: '/users/login?format_ext_json',

waitMsg: ‘Authenticating…’});}
text: ‘Cancel’


Then I have a users controller and inside that controller I have a

def login
@title = “Log in to pinktomato”
if request.get?
@user = User.new(:remember_me => remember_me_string)
elsif param_posted?(:screen_name)
@user = User.new()
@user.screen_name = params[:screen_name]
@user.password = params[:password]
user = User.find_by_screen_name_and_password
if user
logger.info(“found user”)
@user.remember_me? ? user.remember!(cookies) : user.forget!
flash[:notice] = “User #{user.screen_name} logged in!”
render :text => “I HOPE THIS SHOWS”

      # Don't show the password in the view
      flash[:notice] = "Invalid screen name/password combination"

end[/CODE]The “render :text” never renders… It actually just hangs
on the authenticating when u click the login button. What I am
assuming is that possibly the controller has lost reference to the div
it should update. Is this possile. Since when I use a regular link_to
command in rails the login method works fine. Only when called from
the extjs form.

I have tried lost of stuff so far even

[CODE] respond_to do |format|
format.ext_json { render(:update) {|page| page.replace_html
“home” ,:partial=>“loggedIn”) } }


I hope my problem makes sense. I cannot find reference to this
anywhere. I downloaded the extjs scaffold and I took at look at the
generated code because it does create a create method for the
scaffold. However this pre generated scaffold just redirects the user.
I don’t want the page to referesh. Is this my only choice?

[CODE] def create
@site = Site.new(params[:site])

respond_to do |format|
  if @site.save
    flash[:notice] = 'Site was successfully created.'
    format.ext_json { render(:update) {|page| page.redirect_to

sites_path } }
format.ext_json { render :json => @site.to_ext_json(:success
=> false) }
end[/CODE]Please any help would be appreciated…


I am getting a little further if I use

      respond_to do |format|
        format.ext_json { render(:update) {|page|

page.replace_html “home”, :partial => “loggedIn”} }

The partial loads, however the waiting message from the forum never
goes away.
It just hangs…

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs