I'm working with Myfaces 2.0 after a long project using MyFaces 1.1 + Tomahawk + Ajax4JSF. 2.0 is definitely a huge improvement. Although I can't seem to get an onload javascript to work. I stuck this in my head:
<script type="text/javascript">
window.onload = function () {
var fileDownload = document.getElementById('userManagementForm:fileDownload');
if (fileDownload.value == 'true') {
fileDownload.value = false;
window.open('Download');
}
}
</script>
But it doesn't execute. I looked a bit at the source myfacecs JS and I noticed they do some stuff with the onload. Didn't get too much into the details but it seems to block my attempt at overriding the onload event. Is there another way around this, maybe a direct call to the JSF library?
Another question, sort of on the same topic. Ajax4JSF had an attribute "oncomplete" which would let you run some Javascript after the Ajax request completed. Is there an equivalent in MyFaces 2.0 with the f:ajax? Come to think of it I haven't tried event="oncomplete", maybe it'll work.