You need to sign in to do that
Don't have an account?
Jonathan Osgood 3
Uknown Property Error adding custom controller to VF page
The property and method are public so not sure why I'm getting this error:
My Custom Controller:
My VisualForce :
My Custom Controller:
public class MeritusSignupController { public Form__c form {get;set;} public String formId {get;set;} public Account a {get;set;} public Contact c {get;set;} public String is_new {get;set;} public MeritusSignupController() { form= new Form__c(); form.Applicant_First_Name__c = UserInfo.getFirstName(); form.Applicant_Last_Name__c = UserInfo.getLastName(); form.Email__c = UserInfo.getUserEmail(); a= new account(); is_new = ApexPages.CurrentPage().getParameters().get('newform'); formId = ApexPages.CurrentPage().getParameters().get('formid'); String userId= UserInfo.getUserId(); c= new contact(); List<Form__c> formList = new List<form__c>(); if (is_new == 'true') { form = new form__c(); form.Applicant_First_Name__c = UserInfo.getFirstName(); form.Applicant_Last_Name__c = UserInfo.getLastName(); form.Email__c = UserInfo.getUserEmail(); } else if (formId != null) { formList = [Select id, Student__r.Name, Student__c, Applicant_First_Name__c,Applicant_Last_Name__c,Email__c from form__c where id =: formid]; } upsert form; upsert c; }
My VisualForce :
<apex:page Controller="SignupController" showHeader="false" sidebar="false" > <apex:stylesheet value="{!URLFOR($Resource.AppCss)}" /> <body> <apex:form> <div> <apex:inputtext value="{!Form__c.Applicant_First_Name__c}" /> </div> <div> <apex:inputtext value="{!Form__c.Applicant_Last_Name__c}" /> </div> <apex:commandButton value="Save" action="{!save}" /> </apex:form> </body> </apex:page>
This error is coming because on you page you are trying to access Form__c.Applicant_First_Name__c and Form__c.Applicant_Last_Name__c, but you should use 'form' instead of 'Form__c'. As, you have declared in the Controller in the 1st line:
public Form__c form {get;set;}
Also, the controller name on the page should be 'MeritusSignupController' instead of 'SignupController' in the below line:
<apex:page Controller="SignupController" showHeader="false" sidebar="false" >
Please ensure the controller name match.
Please let me know if this helps.
If yes, please mark the question as Solved.
Thanks and Regards,
Anirudh Singh
All Answers
This error is coming because on you page you are trying to access Form__c.Applicant_First_Name__c and Form__c.Applicant_Last_Name__c, but you should use 'form' instead of 'Form__c'. As, you have declared in the Controller in the 1st line:
public Form__c form {get;set;}
Also, the controller name on the page should be 'MeritusSignupController' instead of 'SignupController' in the below line:
<apex:page Controller="SignupController" showHeader="false" sidebar="false" >
Please ensure the controller name match.
Please let me know if this helps.
If yes, please mark the question as Solved.
Thanks and Regards,
Anirudh Singh