You need to sign in to do that
Don't have an account?
Onur Kaya
Visualforce Page Redirection Issue
I have an inline VF page that has two date fields. I prepopulate the dates and when I click on command button it redirects the page into pdf visualforce page. Everything works fine except parameters picked up in URL in the scond run.
Here is my controller
This is the Visualforce page.
Thank you in advance,
O Kaya
Here is my controller
public class FundReportController { public Opportunity TempOpportunity {get;private set;} public final Fund__c f; public date beginingDate{ get{ date currentDate = Date.today(); date beginingDate; integer ThisYear = currentDate.year(); integer LastYear = currentDate.year() - 1; if(currentDate.month() > 9){ beginingDate = date.newInstance(ThisYear,10,1); }else{ beginingDate = date.newInstance(LastYear,10,1); } return beginingDate; } set; } public FundReportController(ApexPages.StandardController controller){ this.f = (Fund__c)controller.getRecord(); TempOpportunity = new Opportunity(); TempOpportunity.FS_Disbursement_Request_Date__c = beginingDate; TempOpportunity.Board_Poll_Date__c = date.today(); } public PageReference FundReportPage(){ Pagereference pagereference=new Pagereference(''); return null; } }
This is the Visualforce page.
<apex:page standardController="Fund__c" extensions="FundReportController"> <apex:form> <apex:pageBlock title="Sample Title" id="block" mode="edit"> <table border="1" bordercolor="#E5053A" style="background-color:#D7ECF3" width="100%" > <tr> <th witdh = "50%">Begining Date</th> <th witdh = "50%">Ending Date</th> </tr> <tr> <td><apex:inputField id="BegDate" value="{!TempOpportunity.FS_Disbursement_Request_Date__c}" label="" required="true"/></td> <td><apex:inputField id="eEndDate" value="{!TempOpportunity.Board_Poll_Date__c}" label="" required="true"/></td> </tr> </table> <apex:commandButton value="GeneratePDF" action="{!FundReportPage}" onclick="window.open('/apex/FundReport?id={!Fund__c.Id}&BegDate={!TempOpportunity.FS_Disbursement_Request_Date__c}&EndDate={!TempOpportunity.Board_Poll_Date__c}','_blank','height=600,location=no,resizable=yes,toolbar=yes,status=no,menubar=yes,scrollbars=1', 1)"/> </apex:pageBlock> </apex:form> </apex:page>
Thank you in advance,
O Kaya
I ended up adding actionSupport. So when I update the date fields it reRenders the form and when I click on the generatePDF button right parameteres are being populated.
Thank you both.
All Answers
Don't know why you are calling FundReportPage function through the button as nothing is happening in the fucntion.
So you can remove thte action from button and just call a javascript function on onclick and pass the value which you need to be required.
-Thanks
Ash
I ended up adding actionSupport. So when I update the date fields it reRenders the form and when I click on the generatePDF button right parameteres are being populated.
Thank you both.