Forum: Ruby on Rails Updated DIV after submit

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Marcelo J. (Guest)
on 2006-12-24 21:11
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".
Phlip (Guest)
on 2006-12-24 22:34
(Received via mailing list)
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!!
Marcelo J. (Guest)
on 2006-12-24 23:07
I make this render in controller, what make this?
Phlip (Guest)
on 2006-12-24 23:26
(Received via mailing list)
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!!
Marcelo J. (Guest)
on 2006-12-26 04:10
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.
Marcelo J. (Guest)
on 2006-12-26 13:28
help.
Marcelo J. (Guest)
on 2006-12-26 15:13

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.
Marcelo J. (Guest)
on 2006-12-27 01:49

help
This topic is locked and can not be replied to.