Dojo.parser.parse only works the first time it is called
I have a page where when a user clicks on a link to some reporting tools, it first prompts them for some report parameters. I am getting the options dialog as a form using AJAX, based on the link id. Each dialog has several dojo controls, so I need to parse them when the dialog pops up because it is not part of the page.
The first dialog box when the callee works fine, but subsequent calls to the dialog boxes fail to parse the dojo controls.
Example:
showParametersDialog : function(doc) {
var content = doc.firstChild.firstChild.data;
var container = document.createElement('div');
container.id = 'dialog';
container.innerHTML = content;
container.style.background = 'transparent';
container.style.position = 'absolute';
container.style.top = (document.body.clientHeight / 2) - 124 + "px";
container.style.left = (document.body.clientWidth / 2) - 133 + "px";
container.style.display = 'block';
document.body.appendChild(container);
// set up date fields
var date_from = dojo.byId('date_from');
var date_to = dojo.byId('date_to');
try {
date_from.value = dojo.date.locale.format(new Date(), {selector: 'date'});
date_to.value = dojo.date.locale.format(new Date(), {selector: 'date'});
} catch(e) {
var now = new Date();
date_from.value = String(now.getMonth() + "/" + now.getDate() + "/" + now.getFullYear());
date_to.value = String(now.getMonth() + "/" + now.getDate() + "/" + now.getFullYear());
}
dojo.parser.parse();
}
All dialogs have common date fields. So when I call this dialog for the first time and dojo.parser.parse () is called, it parses the controls in the dialog, but only the first time ... after, not dojo.
Any thoughts?
Thank you Paul.
+2
source to share
3 answers