Can I refresh a remotely updated section once?


#1

My object has_many Link objects. So I’ve set up a form on my edit page
that uses form_remote to accept a text field and then dynamically create
and add a new Link object and remain on the same page. I have a div
id=“links” region that gets updated to show the current list of links.
This works fine.

But when I first load the page, if the object already had links, how do
I signal the links section to draw itself, before the form is submitted
for the first time?
If I just put some HTML code in that section I assume that it will be
rendered every time and I’ll get redundant output.


#2

Duane M. wrote:

My object has_many Link objects. So I’ve set up a form on my edit page
that uses form_remote to accept a text field and then dynamically create
and add a new Link object and remain on the same page. I have a div
id=“links” region that gets updated to show the current list of links.
This works fine.

But when I first load the page, if the object already had links, how do
I signal the links section to draw itself, before the form is submitted
for the first time?
If I just put some HTML code in that section I assume that it will be
rendered every time and I’ll get redundant output.

A snippet of relevant code might help, because I don’t think it’s clear
what you are asking.