Forum: Ruby on Rails updating the dom

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.
E98de78bb42013c488fe8aa9d77d2cb1?d=identicon&s=25 Steve Odom (Guest)
on 2006-04-02 23:03
(Received via mailing list)
Hi list,

Say I've got a page that lists the students names and grades. Grades are
clickable using a form_remote_tag that then renders a new partial on the
right hand side of the page that then lists the individual test scores
for
the particularly student. So far so good.

And lets say in the newly rendered right-hand section, I have another
form_remote_tag that will allow me to input a new grade for that
student.
I'd like to set an onfocus event for that text input field that
element.shows another div (that displays a help message, lets say).

The problem I am having is that I can't get the onfocus event to work
because -- since the field is contained in a newly rendered div that
wasn't
present when the page first loaded -- its id doesn't seem to be found in
the
dom and so the onfocus won't trigger.

Is there a javascript command that can be used to refresh the dom when a
partial is rendered?

Thanks,

Steve Odom
http://www.smarkets.net
73606b1d1042de19056f3d59492b652f?d=identicon&s=25 Charlie Bowman (beachguy82)
on 2006-04-03 02:53
Steve Odom wrote:
> >
> Is there a javascript command that can be used to refresh the dom when a
> partial is rendered?
>

You shouldn't have to refresh the dom.  Just because you can't "view
source" to see the new element doesn't mean that the browser doesn't
know it's there.
54532f023496410e0d7b1add5561ba45?d=identicon&s=25 Manuel Holtgrewe (Guest)
on 2006-04-03 03:09
(Received via mailing list)
Am 03.04.2006 um 02:53 schrieb charlie bowman:

> Steve Odom wrote:
>>>
>> Is there a javascript command that can be used to refresh the dom
>> when a
>> partial is rendered?
>>
>
> You shouldn't have to refresh the dom.  Just because you can't "view
> source" to see the new element doesn't mean that the browser doesn't
> know it's there.

The "Web Developer's Tool Bar" for Firefox has a "View Generated
Source" feature that allows you to see a HTML dump of the current DOM
tree - and of course there always is Firefox' and Mozilla's great DOM
tree viewer.

*m
B09a3f6cdc4797532647d2d264b5df49?d=identicon&s=25 Jodi Showers (jshow)
on 2006-04-03 03:09
(Received via mailing list)
Hey Steve - I suggest you pickup firebug (if your using firefox that
is),

https://addons.mozilla.org/extensions/moreinfo.php?
application=firefox&id=1843

amongst a bunch of great css, javascript and dom tools it'll give you
"View Source Live".

Some other capabilities:

* Status bar icon shows you when there is an error in a web page
* A console that shows errors from JavaScript and CSS
* Log messages from JavaScript in your web page to the console (bye
bye "alert debugging")
* An JavaScript command line (no more "javascript:" in the URL bar)
* Spy on XMLHttpRequest traffic
* Inspect HTML source, computed style, events, layout and the DOM

cheers,
Jodi
This topic is locked and can not be replied to.