We've been using xforms-ready event from the model to hide the form until it's loaded (as in http://www.formsPlayer.com/node/351) but have noticed that forms with largeish instances the xforms-ready event will be fired, but the form wont actually have finished rendering.
Is there any way to capture when the form has actually finished rendering?
Thanks
-alastair

Wait for document ready
That's an interesting one. One possibility would be to modify the script to check for 'document ready', and if it's not yet ready, set up a timer with a callback. Another trick you might try (although I don't like it, and don't know if it will work) is to add a simple model to the end of your document, and to put the
xforms-readyhandler on that. The idea would be that since it is the last item on the page, everything will hopefully have been set up by the time the browser processes it.Let us know which way you go!
--
Mark Birbeck, formsPlayer
http://www.formsPlayer.com | http://internet-apps.blogspot.com
standards. innovation.
Render complete
The most reliable solution turned out to be a combination of both the additional model at the bottom of the page and checking the document.readyState
Not elegant, but works.
<script type="text/javascript">
function fnCheckReady(){
if(document.readyState=="complete"){
document.getElementById("main-body").style.display = "block";
document.getElementById("loading-msg").style.display = "none";
}
else{
window.setTimeout("fnCheckReady()",2000);
}
return true;
}
</script>
<div id="loading-msg">Loading form. Please wait.</div>
<div id="main-body">..... main large xform here ....</div>
<xforms:model id="tailendmodel"/>
<script for = tailendmodel event= xforms-ready type="text/javascript">
fnCheckReady()
</script>