[Logo] RSF Discussions Forum
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
AJAX example: getElementById() created by UIInitBlock.make() failling  XML
Forum Index -> RSF Help and Problems
Author Message
Azanchetta
Newcomer

Joined: 13/03/2009 12:40:12
Messages: 3
Offline

Hi there!

I'm new using RSF and I'm trying to apply AJAX functionalities into a project following the example "RSF and AJAX" at rsfwiki.
I followed that example strictly but I faced the strange situation: the javascript function initMyAjaxStuff(), added by the the UIInitBlock.make function at the beggining of the page execution, isn't finding the input-text object of ID="input_field" when executing the document.getElementById() function inside it. Trying with another input-text element added just for test (but this one not modified by RSF as the first one), the same error occuried. It seems that the javascript function added by the UIInitBlock.make operation is executed even before the page is loaded, so no elements are found (I used the Firefox WebDeveloper Plugin for find these javascript errors).

I searched at the forum but didn't found anything similar to this situation.

PS: English is not my native language, so I would like to ask you to not be affraid of saying that you didn't understand something I've said

"We create dragons for the same reason we create God: because we know that the life has no meaning without them."
antranig2
Request-scope Wrangler

Joined: 05/06/2006 02:51:30
Messages: 24
Offline

Yes, it is executed at page load. To make sure that elements can be found by id, you must make sure that the markup corresponding to the UIInitBlock is placed *later on*, that is, further down in the HTML document than any elements its tries to refer to.

Hope this solves your issue,
Cheers,
boz.
Azanchetta
Newcomer

Joined: 13/03/2009 12:40:12
Messages: 3
Offline

Thanks very much antranig,
the problem was solved just by passing the javascript block with the rsf:id="init_js" from the beggining to the end of the HTML page.

So, in the end it was not a RSF problem, but a javascript problem...

Thanks again.

"We create dragons for the same reason we create God: because we know that the life has no meaning without them."
 
Forum Index -> RSF Help and Problems
Message Quick Reply
Go to:   
Powered by JForum 2.1.6 © JForum Team