You need to sign in to do that
Don't have an account?
How to open a VF page as a pop up in another VF page's onclick?
Hi I have a command link on a Visualforce page and I need to open another VF page as a popup window on click of the commnad link.
This is my Commnad link in the main VF page.
<apex:CommandLink Value="Select Product" onclick="window.open('/apex/oppprdpage?id={!as.lnkass.SalesOpportunityId__c}')"/>
Right now, on click of this link the new page is opening as a new tab but I need to open the new VF page as a popup window. Is there any way that I can achieve this? (Basically I am trying to replicate the standard lookup window).
Thank You in advance for your help!!
Regards,
Sravan.
All Answers
<script language="javascript" type="text/javascript">
function popitup(url) {
newwindow=window.open(url,'name','height=200,width=150');
if (window.focus) {newwindow.focus()}
return false;
}
</script>
<apex:form >
<apex:CommandLink Value="Select Product" onclick="window.open('/apex/oppprdpage?id={!as.lnkass.SalesOpportunityId__c}')"/>
</apex:form></apex:page>
That worked!! Thank You for the help.
Regards,
Sravan.
I am in similar situation and need some help..
I have a command button on a Visualforce page and upon click I need to open a URL in an iFrame i.e. a web browser inside an iFrame
Here is my code I am working.. please can you help with the correct code..?
<apex:page sidebar="False">
<apex:form >
<apex:commandButton onclick="toGoogle();" value="Google"/>
</apex:form>
<script>
function toGoogle() {
redirectTo('http://www.google.com');
}
function redirectTo(target) {
if (inIframe()) {
// step out of an iframe (if opened via iframe)
window.top.location.href = target;
return false;
} else {
window.location.href = target;
}
}
function inIframe() {
try {
return window.self !== window.top;
} catch (e) {
return true;
}
}
</script> -->
</apex:page>