You need to sign in to do that
Don't have an account?
ActionPoller, JavaScript and IE woe
I have a VF page that contains an actionpoller to refresh a section every 'n' seconds. In order to let the user know that this is happening, I'm using an actionstatus with start/stop attributes to invoke javascript functions.
I've found that while this works fine in Chrome and Firefox, IE 7 and 8 throw errors. I've managed to dwindle this down to the following page:
<apex:page tabstyle="Account" showheader="false" standardstylesheets="true"> <script> function start() { alert("Starting"); } function stop() { alert("Stopping"); } </script> <!-- <h1>Poller Test</h1> --> <apex:form > <apex:actionStatus id="sref" onstart="start()" onstop="stop()"/> <apex:actionPoller interval="10" rerender="status" status="sref"/> <apex:outputPanel id="status"> Here is the panel </apex:outputPanel> </apex:form> </apex:page>
When I access this page in IE, I get JavaScript errors that
'window.document.getElementById(...)' is null or not an object'. If I remove the comment around the line:
<!-- <h1>Poller Test</h1> -->
Then it works fine for IE.
It appears that inserting some regular HTML in between the javascript and apex:form components fixes it, but I've no idea why.
Any suggestions as to what is causing this (I've already drawn the obvious conclusion that its an IE bug!)
I've had this problem to but I was happy to go with the work around instead of worrying about it. IE is just not a very good product.
There was some problem in your code. Find below the modified code :
<apex:page tabstyle="Account" showheader="false" standardstylesheets="false">
<apex:form >
<apex:outputPanel>
Here is the panel
</apex:outputPanel>
<apex:actionPoller interval="5" rerender="status" status="sref"/>
<apex:actionStatus onstop="stop() " />
<script>
function start()
{
alert("Starting");
}
function stop()
{
alert("Stopping");
}
</script>
</apex:form>
</apex:page>
Did this answer your question? if so, please mark it solved.
The code doesn't work as the rerender/status attribute ids don't exist in the page.
Having fixed the code above, it does cause the onstop to fire. Thus it appears to be an ordering issue.of the javascript sequencing straight into the form tag. Still not managed to reproduce it on any other browser though, so it does appear to be an IE gotcha.