Skip to main content

Is it possible to run java script within the dContainer control?

4 replies [Last post]
Joined: 2008-06-16


I have a dContainer control within which I am loading an html form which I have created dynamically (I use the '/setContent' publish/subscribe event to do this).

All works fine, however, in some cases I need to submit the html form as soon as it loads. I was hoping to use java script for this but it appears this is not being executed in the dContainer control.

Anyone have any ideas how I can get the java script to fire? the html I pass to the dContainer is as follows (nb I have also tried adding the script to the onload attribute of the body tag but have the same problem):


Alternatively - is there a way to access the content of the dcontainer control from the glue.js file? Something like:

var myDContainer = document.getElementById("dContainer");

Thanks in advance for any help/suggestions

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2003-07-31

Hi DWhite,

Are you using the iframe property on the dContainer? The way at getting at the content differs when you do.

If you aren't using an iframe I believe the easiest way to get the content is to:

1) Give the dContainer an id property (this is assigned to div element used by the dContainer).

2) Assign the internal view an id

The id is constructed using the dContainer's id + _ + the viewid.



The from your code you should be able to get the content using:


An easier way to do what you are trying would be to assign the form element in your dontainer a known id and get the form element that way. I detail this in a blog posting on form processing with jMaki / Ajax.

Let me know if this doesn't work.


Joined: 2008-06-16

Thanks for such a quick response.

I should have said - I am using an iframe.

I'm able to access the internal view by assigning an ID, but i don't know how to get access to the iframe...

(I don't seem to be able access the form element directly).

Joined: 2003-07-31

jMaki publish / subscribe still works across iframes. One thing you could do as an easy fix is include your form processing code as part of the iframe document then do a jmaki.publish to get the information to another component in the surrounding page.

When you do this make sure to turn on the debugger as the publish names will get pre-pended with a /global

To turn on the publish subscribe debugger / logger do the following after jMaki has been loaded (your first component defined).

jmaki.debug = true;
jmaki.debugGlue = true;

you can get one of these in the internal dcontainer too.

Let me know if this is enough to get you going. There is another more difficult solution that I have in mind.

Is this enough to get you going?


Joined: 2008-06-16

Thanks for the suggestion Greg. I will take a look into this approach.