You need to sign in to do that
Don't have an account?
JN22
Open Commandbutton in new Window
Hello,
I have the following line of code in my VF page:
<apex:commandButton value="Generate PDF" action="{!URLFOR($Page.AcctPlanPDF,null,[Id=Account_Plan__c.id])}" style="background:#99CCFF; font-weight=bold"/>
I would like this to open a pop-up window to the AcctPlanPDF page when the button is clicked. Does anyone know how to accomplish this while maintaining the commandButton? Thanks.
Hi ,
I believe that you want to place the "Generate PDF" button either on the Account_Plan__c Object layout or in the VisualForce page with Controller as Account_Plan__c. To open it new window, we need to go for window.open() as below
Try this code,
<apex:form >
<apex:commandButton value="Generate PDF" onclick="window.open('/apex/AcctPlanPDF?id='+'{!Account_Plan__c.Id}','_blank','height=600,location=no,resizable=yes,toolbar=no,status=no,menubar=no,scrollbars=1', 1)" style="background:#99CCFF; font-weight=bold" />
</apex:form>
This should work, let me know in case of any issues.
Please mark this post as solved, if it helps you.
Regards,
Bharathi
Salesforce For All
All Answers
Hi ,
I believe that you want to place the "Generate PDF" button either on the Account_Plan__c Object layout or in the VisualForce page with Controller as Account_Plan__c. To open it new window, we need to go for window.open() as below
Try this code,
<apex:form >
<apex:commandButton value="Generate PDF" onclick="window.open('/apex/AcctPlanPDF?id='+'{!Account_Plan__c.Id}','_blank','height=600,location=no,resizable=yes,toolbar=no,status=no,menubar=no,scrollbars=1', 1)" style="background:#99CCFF; font-weight=bold" />
</apex:form>
This should work, let me know in case of any issues.
Please mark this post as solved, if it helps you.
Regards,
Bharathi
Salesforce For All
Thanks Bharathi, that worked like a charm!!
<apex:commandButton value="Generate PDF" onclick="window.open('/apex/AcctPlanPDF?id='+'{!Account_Plan__c.Id}','_blank','height=600,location=no,resizable=yes,toolbar=no,status=no,menubar=no,scrollbars=1', 1)" style="background:#99CCFF; font-weight=bold" />
Please give 2 more variables Example in above Command button