Fixing the following javascript code contains my newest task:
// submit the form in the iframe:
document.getElementsByTagName("iframe")[0].contentWindow.dojo.byId(buttonId).click();
// wait 50msec for result to be loaded:
window.setTimeout(function(){
// get documentId of newly created document from result
var docId = document.getElementsByTagName("iframe")[0].
contentWindow.dojo.byId("documentIdDiv").innerHtml;
// put documentId into the outer form
Ext.getCmp("form").getForm().findField("documentId").setValue(docId);
// submit outer form
Ext.getCmp("form").getForm().submit({
...
});
}, 50);
// TODO: Error if result is not available after 50ms.
I now have to find a way to execute the anonymous function once the iframe has reloaded.
I thought of using a body onload on the iframe, but I can't, because I would have to insert it in the body of the new page.