You need to sign in to do that
Don't have an account?
How to resolve this Error Unknown property 'ExtentionController.objPatient'
Hi,
I created the Custom object named by Patient, i want custom page for save the relevant data in this object ...so i create the page controller class as given below
public with sharing class ExtentionController
{
Patient__c objPatient = new Patient__c();
Physician__c objPhysician = new Physician__c();
Case_Accession__c objAccession = new Case_Accession__c();
public void save()
{
try
{
Insert objPatient;
Insert objPhysician;
objAccession.Patient__c = objPatient.id;
objAccession.Physician__c = objPhysician.id;
Insert objAccession;
}
catch(Exception ex){ }
}
}
VF page
<apex:page controller="ExtentionController" >
<apex:form >
<apex:pageblock title="Hello {!$User.FirstName}!" >
<h1>Congratulations</h1>
This is your Accession Page !!<p/>
<apex:pageBlockSection >
<apex:inputText value = "{!objPatient.FirstName__c}"/>
<apex:inputtext value = "{!objPhysician.FirstName__c }"/>
</apex:pageBlockSection>
<apex:pageBlockButtons >
<apex:commandButton action="save()" value="Go"/>
<apex:commandButton action="{!cancel}" value="Cancel">
</apex:commandButton>
</apex:pageBlockButtons>
</apex:pageblock>
</apex:form>
</apex:page>
You don't have getters and setters for
Hi,
You need to use get;set; and declare variable as public,if you want to access the class variable in visual force Page.
public with sharing class ExtentionController
{
public Patient__c objPatient {get;set;}
Physician__c objPhysician = new Physician__c();
Case_Accession__c objAccession = new Case_Accession__c();
public ExtensionController() {
objPatient= new Patient__c();
}
/*** do other work.***/
}
Thanks for the reply Puja but ,, when I am saving my record
java.lang.IllegalArgumentException: Illegal view ID save(). The ID must begin with /
this another error is coming, Any idea
Regards
Raman
Hi,
<apex:commandButton action="save()" value="Go"/>
change it to
<apex:commandButton action="{!save}" value="Go"/>
It worked, You are brilliant
Cheers
Raman
Hi,
Thanks
Please mark it as a solution ,And if the above post helps you please give Kudos(click on start at left)
Ok, that I will do ,
But can explaiin how this is taking the function Save of Controller
<apex:commandButton action="{!save}" value="Go"/>
Because in Satandard object we write like this only
action = save()
This is the way to invoke controller method in visual force page.