Updated DIV after submit


#1

I have two DIV`s, one for menu(div “menu”), and other for appear the
forms(div “tela”).Well, after execute submit of view “new”, is load the
view of scaffold, in new window. I want that after execute the submit,
the view “list” appear in my div “tela”.


#2

Marcelo J. wrote:

I have two DIV`s, one for menu(div “menu”), and other for appear the
forms(div “tela”).Well, after execute submit of view “new”, is load the
view of scaffold, in new window. I want that after execute the submit,
the view “list” appear in my div “tela”.

I am beginning to suspect that a Rails Ajax project should prefer
“render :update” over :update => ‘id’. That means instead of the View
RHTML containing…

remote_something :update=>‘my_div’, …

we should prefer a controller action responding with:

render :update do |rjs| # some call that |page|
rjs.replace_html ‘my_div’, my_new_html
end

So you might be able to do this:

render :update do |rjs|
rjs.replace_html ‘my_div’, my_new_html
rjs.replace_html ‘my_list’, my_new_list
end

Now the question arises how to extract my_new_html and my_new_list
from scaffold-land.

And note that scaffolds should never be treated as production code
(just as real-life scaffolds should never be treated as real
buildings). You should learn from them, then write your own
controllers and views.

Also note that you can update anything with contents, not just a DIV…


Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!


#3

I make this render in controller, what make this?


#4

Marcelo J. wrote:

I make this render in controller, what make this?

I can’t understand your question. Copy a little of your code into your
post and ask again, a different way.


Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!


#5

Phlip wrote:

Marcelo J. wrote:

I make this render in controller, what make this?

I can’t understand your question. Copy a little of your code into your
post and ask again, a different way.


Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!

I not have code, therefore I do not know I eat to start. I want loading
one DIV after a submit. I like to make something as “link_to_remote”,
together with submit it form.


#6

Well, I tried make the following:
<%= link_to_remote “Salvar”,{:update => “tela”, :url => {:controller
=> “cliente”, :action => “create”}},:class => “botao2” %>

But return the message “validates_presence_of” of model of cliente. But
the fields are correct.


#7

help


#8

help.