You need to sign in to do that
Don't have an account?
Passing record ID's to Visualforce pages
I've got a page full of input fields that I want to print. To do this, I'm mirroring the page, making modifications so it looks printable, and then using renderas="pdf." I want to have a button on the input page that links directly to the pdf version with the ID of the input record, so that all the fields are filled in on the PDF version for that input record. I've tried to do the following, which links to the pdf page, but doesnt display the information from the record.
<apex:commandButton style="font-size:14px" action="{!URLFOR($Page.DocPrintPage, MyObject__c.Id)}" value="Print" />
Any ideas?
There's a number of ways to do this. Here's a couple.
You could have an action method in the controller that returns a pagereference to the pdf page, and set the id into the parameters. E.g.
PageReference gotoPDF() { PageReference result=Page.MyPdfPage; result.getParameters().put(id, MyObject__c.id); result.setRedirect(true); return result; }
Or you could do something with the onclick event of the button:
<apex:commandButton value="Print" onClick="window.location='MyPdfPage?id={!MyObject__c.id}'; return false;" />
All Answers
There's a number of ways to do this. Here's a couple.
You could have an action method in the controller that returns a pagereference to the pdf page, and set the id into the parameters. E.g.
PageReference gotoPDF() { PageReference result=Page.MyPdfPage; result.getParameters().put(id, MyObject__c.id); result.setRedirect(true); return result; }
Or you could do something with the onclick event of the button:
<apex:commandButton value="Print" onClick="window.location='MyPdfPage?id={!MyObject__c.id}'; return false;" />
Hello sir,
below is my question...please help me out in calling vf page after selecting one record from list... :
In the 1st page, use event="onchange" within <apex:selectList> to go to the 2nd page.
help me in below question....
any help wud b greatly appreciated...