function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sales4cesales4ce 

Load VisualForce Page in a new Window

Hi,

 

I have a Visual force page and a command button when clicked would load another Visualforce page.

Can we load that new visualforce page on button click in a new window?

 

I have a roadblock to get that done. Any help is great.

 

Thanks,

Sales4ce

Best Answer chosen by Admin (Salesforce Developers) 
Ritesh AswaneyRitesh Aswaney

function launchWindow()

{

window.open("/apex/VFPageName?id={!id}");

}

 

should do it ?

 

if id by itself doesnt work, you could use {!CONTROLLER_VARIABLE.Id}

All Answers

Ritesh AswaneyRitesh Aswaney
<apex:page standardController="Account" >
<script>
function launchWindow()
{
window.open("/apex/VFPageName");
}
</script>
<apex:form >


<apex:commandButton action="{!METHOD}" value="METHODNAME" id="theButton" onClick="launchWindow();"/>
</apex:form>
</apex:page>
venkatasubhashkvenkatasubhashk

 <apex:outputLink value="/apex/VFPageName" target="_blank">

 

 

Hope this Helps you !

sales4cesales4ce

Thanks for your reply Ritesh.

I have a question:

 

The java script definitely launches the new window , but i need to pass the parameters as well to it . (example Id of the record. /apex/pagename?id='somevalue').

 

How can this be accomplished?

 

Thanks,

Sales4ce

Ritesh AswaneyRitesh Aswaney

function launchWindow()

{

window.open("/apex/VFPageName?id={!id}");

}

 

should do it ?

 

if id by itself doesnt work, you could use {!CONTROLLER_VARIABLE.Id}

This was selected as the best answer
sales4cesales4ce

That worked like charm !

Thanks.

 

Since you were so helpful, i have an issue(below is the link) and would you mind dropping your thoughts as well.

http://boards.developerforce.com/t5/Visualforce-Development/Insert-Opportunity-Line-Item-after-Overriding-with-VF-page/td-p/270229

 

Sales4ce