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
Shwetal DesaiShwetal Desai 

Open Visual Force page as a Popup

Hi
 
I have created two visual force page, one named "giftcert" and another is "invoice"
 
I have created one command button on "invoice" page and click of that command button i want to open "giftcert" page as a pop up page.
 
VF Code:
 
<apex:page Controller="POSInvoice" tabStyle="POS__c">
<!-- Start page content -->
<script type="text/javascript">
function openpopup()
{
    window.open("/apex/giftcert","GiftCertificate","width=670,height=480"); //+pageURL,"Sell Gift Certificate","height=250,width=350");
}
</script>
<apex:form >
<apex:commandButton action="openpopup()" value="Sell Gift Certificate"/>
</apex:form>
but its not working..
any suggestion? any idea?
 
 
 
Mark YoungMark Young

try:

Code:
<apex:commandButton onclick="openpopup();return false;" value="Sell Gift Certificate" />


 

Shwetal DesaiShwetal Desai

Thanks Mark Young,

I tried it.. but it shows me following error message.


Illegal view ID openpopup();return false;. The ID must begin with /

any idea?
Shwetal DesaiShwetal Desai

Hey its done

Thanks a lot Mark for helping me

that error is due to wrong syntax of window.open() in javascript.

Thanks again

 

 

jwetzlerjwetzler
please use the {!$Page.giftcert} syntax when creating urls on your page.  It is much safer than hard coding in the url.
Shwetal DesaiShwetal Desai
Thanks Jill Wetzler,
 
U r right its much safer than hard codding URL
 
Thanks for proper guidance. proper guidance is really helpful
 
Keep guiding.
 
 
Cool_DevloperCool_Devloper
Hello VF Gurus,
 
Need your help!!
 
I have a requirement wherein i need to open a small pop-up window on the click of a link from a custom VF screen. This would be passed some input parameters as well.
 
It would have some fields/drop downs which the user can enter/select and on click of "Submit" these values should get saved at the back end in some custom object. Also, the parent window should get refreshed automatically as this window is closed.
 
Can you please let me know what is the best and the most efficient way of achieving this functionality? Any guidance/ideas would be of great help.
 
Many Thanks,
Cool_D