Note that there are some explanatory texts on larger screens.

plurals
  1. POGet instance of child object in iframe
    primarykey
    data
    text
    <p>I need to automate a web form which uses iframes to embed child 'forms' which can be considered as separate html pages.</p> <p>So you get a parent document which contains what they call view fields which are iframes. Within the iframes are the 'child' embedded web pages.</p> <p>A simple example:</p> <p> </p> <p> </p> <p>I have cut out a lot off the html to reduce it to a reasonable size</p> <pre><code>&lt;html&gt; &lt;body&gt; &lt;div id="123" arid=123 artype="View" ardbn="vfMyChild" class="arfid123 ardbnvfMyChild" STYLE="top:49 left:75 width:1038 height:322" arvfframe="&amp;lt;iframe style=&amp;quot;top:0 left:0 width:1038; height:322&amp;quot name=&amp;quot;VF123&amp;quot; title=&amp;quot;View Field&amp;quot; src=&amp;quot;javascript:&amp;amp;quot&amp;#59;&amp;amp;lt&amp;#59;HTML&amp;amp;gt&amp;#59;&amp;amp;lt&amp;#59;/HTML&amp;amp;gt&amp;#59;&amp;amp;quot&amp;#59;&amp;quot; &amp;gt; &amp;lt;/iframe&amp;gt;"&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Then the embedded child html could be simple like this:</p> <pre><code>&lt;html&gt; &lt;body&gt; &lt;div id="321" arid=321 artype="Char" ardbn="txtRegister"&gt; &lt;label id="label321" class="label f6"&gt;Register:&lt;/label&gt; &lt;textarea id="arid_321" cols="20" maxlen=255 rows=1&gt;&lt;/textarea&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>The html contained in the STYLE= looks a bit odd - not sure why it is like that. But I can see it is sort of an iframe.</p> <p>I have an instance of the top level document object and I have an instance of the div with id=123. I need to automate the textarea object in the child. I tried the following which did not work.</p> <pre><code>var viewfields; //is a ref to the div with id=123 if(viewfields) { window.alert("viewfields.length=" + viewfields.length); //prints len=1 as expected // line below get Caught exception: Unable to get value of the // property 'document': object is null or undefined var innerDoc = viewfields[0].contentDocument || viewfields[0].contentWindow.document; if(innerDoc) { window.alert("Wohoo we have an innerDoc"); } } else window.alert("no view fields found"); </code></pre> <p>I am testing this using IE9.</p> <p>Will I be able to get an instance of the inner web page with this html? If so, how?</p> <p>EDIT</p> <p>If it helps, here is the actual, unedited html for the div in question.</p> <pre><code>&lt;div id="WIN_0_536870915" arid=536870915 artype="View" ardbn="vfCubaChildren" class="arfid536870915 ardbnvfCubaChildren" STYLE="top:49&amp;#59; left:75&amp;#59; width:1038&amp;#59; height:322&amp;#59;z-index:1001&amp;#59;background-color:transparent&amp;#59;" arvfframe="&amp;lt;iframe style=&amp;quot;top:0&amp;amp;#59&amp;#59; left:0&amp;amp;#59&amp;#59; width:1038&amp;amp;#59&amp;#59; height:322&amp;amp;#59&amp;#59;background-color: transparent&amp;amp;#59&amp;#59;&amp;quot; name=&amp;quot;VF536870915&amp;quot; frameborder=1 scrolling=&amp;quot;auto&amp;quot; allowtransparency=&amp;quot;true&amp;quot; title=&amp;quot;View Field&amp;quot; src=&amp;quot;javascript:&amp;amp;quot&amp;#59;&amp;amp;lt&amp;#59;HTML&amp;amp;gt&amp;#59;&amp;amp;lt&amp;#59;/HTML&amp;amp;gt&amp;#59 ;&amp;amp;quot&amp;#59;&amp;quot; onload=&amp;quot;DVFol&amp;amp;#40&amp;#59;&amp;amp;#41&amp;#59;&amp;quot;&amp;gt; &amp;lt;/iframe&amp;gt;"&gt; &lt;/div&gt; </code></pre> <p>That div holds the child form. The child form is like another html web page. It has standard html input fields and textarea's. I need to post text to the textarea's in the child (from the parent). But the problem is I cannot yet access the child html object from the parent.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload