You need to sign in to do that
Don't have an account?

My Visual Force Page that uses a custom Apex controller wont show fields
Finally got all the testing done for my Apex controller and got the print layout functioning as I wanted but a huge problem I have encounterd now is that my Visual Force Page isnt showing any data. What must I add to my Visualforce/Apex to show the values that I have in the fields.

Ive had this problem before but couldnt figure it out. Here is some information It should be displaying.

Here is my apex Class:-
Thankyou for all and any help!
Ive had this problem before but couldnt figure it out. Here is some information It should be displaying.
Here is my apex Class:-
public class PrintableView{ public Apprentice__c ApprenticeObj{get;set;} public Programme_Area__c ProgramArea {get;set;} public Boolean bolPrintableView {get;set;} public void init() { String strPrintableView = ApexPages.currentPage().getParameters().get('print'); bolPrintableView = (strPrintableView == '1'); } public PageReference save(){ if(ApprenticeObj != null){ } return null; } }Visual Force componet used to make the print function:-
<apex:component controller="PrintableView" allowDML="true"> public PrintableView(){ ApprenticeObj = new Apprentice__c(); ProgramArea = new Programme_Area__c (); ProgramArea.PA_Code__c = 'P12'; insert ProgramArea; } </apex:component>And a small Snippet of the Visualforce Page
<apex:page lightningStyleSheets="True" Controller="PrintableView" title="Learning Agreement" showHeader="{!bolPrintableView}" sidebar="{!bolPrintableView}" action="{!init}"> <apex:form > <apex:outputPanel rendered="{!NOT(bolPrintableView)}"> <a href="/apex/Apprentice?print=1" target="_blank">Printable View</a> </apex:outputPanel> <apex:outputPanel rendered="{!bolPrintableView}"> <script> window.print() </script> </apex:outputPanel> <apex:pageBlock > Learner ID :- <apex:inputField value="{! ApprenticeObj.Learner_Reference_Number__c }"/> <apex:pageBlockSection columns="3"> <apex:inputField value="{! ApprenticeObj.Date_of_Birth__c}"/> <apex:inputField value="{! ApprenticeObj.Surname__c}"/> <apex:inputField value="{! ApprenticeObj.First_Name__c}"/> <apex:inputField value="{! ApprenticeObj.Middle_Other_Names__c}"/> <apex:inputField value="{! ApprenticeObj.Previous_Surname__c}"/> <apex:inputField value="{! ApprenticeObj.Preferred__c}"/> <apex:inputField value="{! ApprenticeObj.Gender__c}"/> <apex:inputField value="{! ApprenticeObj.ULN__c}"/> <apex:inputField value="{! ApprenticeObj.NI_Number__c}"/> </apex:pageBlockSection> </apex:pageBlock>
Thankyou for all and any help!
Refer this sample code
All Answers
Refer this sample code
RajV seems to have the fix. I was just wondering would it make more sense for me to put the print function I created into an Extention and just use the Apprentice__c Standard Controller?