You need to sign in to do that
Don't have an account?

Parent page refresh on popup
I have a commandbutton that opens a popup window but when the popup is launched the parent page seems to refresh. How can I prevent the parent page refresh from happening?
Any help much appreciated.
<script> var newWin=null; function openPopup() { var url="/apex/DocumentExt"; newWin=window.open(url, 'Popup','height=500,width=400,left=100,top=100,resizable=no,scrollbars=no,toolbar=no,status=no'); newWin.focus(); return false; } </script> <apex:commandButton onclick="openPopup();" value="Popup" immediate="true"/>
Try putting "return false" part inside the onClick attribute.
<apex:commandButton onclick="openPopup();return false;" value="Popup" immediate="true"/>
All Answers
You need to set an empty rerender attribute on the command button.
<apex:commandButton onclick="openPopup();" rerender="" value="Popup" immediate="true"/>
Many thanks for your repsonse. I've just tried setting an empty rerender attribute but the bahaviour remained the same. So I also tried the following and that seemd to work okay.
<apex:commandButton onclick="openPopup();" reRender="dummy" value="Attach file" immediate="true"/> <apex:outputText rendered="true" id="dummy" rendered="false"></apex:outputText>
Any idea why the empty rerender attribute didn't work? Is it a browser issue (I'm using Firefox 3.5)? I'd rather not have the dummy outputtext if at all poss.Try putting "return false" part inside the onClick attribute.
<apex:commandButton onclick="openPopup();return false;" value="Popup" immediate="true"/>