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

VF page doesn't recognize custom controller property
Hello,
I've created a custom controller like below
and my VF page code is
I got an error "Unknown property 'newTaskForTypeController.typeOfTask'".
any help please
I've created a custom controller like below
public class newTaskForTypeController { public TaskForTypes__c typeOfTask; public string SelectedTaskId { get; set; } public TaskForTypes__c getTaskTypes(){ if(typeOfTask == null) return new TaskForTypes__c(); return typeOfTask; } //First page which will contain name public PageReference step1(){ return Page.Tasks_For_Types1; } //Second page which will contain Sub type name and public PageReference step2(){ return Page.Tasks_For_Types2; } //Cancel the operation public PageReference cancel(){ //Navigate to first page PageReference tft1 = new ApexPages.StandardController(typeOfTask).view(); tft1.setRedirect(true); return tft1; } //Save method public PageReference save(){ if(typeOfTask == null) typeOfTask = new TaskForTypes__c(); insert typeOfTask; PageReference tft1 = new ApexPages.StandardController(typeOfTask).view(); tft1.setRedirect(true); return null; } //Get cuurent tasks public List<TaskForTypes__c> getTypeTasks(){ List<TaskForTypes__c> tsks = [SELECT Subject__c, Task_Description__c FROM TaskForTypes__c WHERE Sub_Type_Name__c =: typeOfTask.Sub_Type_Name__c]; return tsks; } //Delete Task from List public void DeleteTask() { // if for any reason we are missing the reference if (SelectedTaskId == null) { return; } // find the account record within the collection TaskForTypes__c tobeDeleted = null; for(TaskForTypes__c a : getTypeTasks()) if (a.Id == SelectedTaskId) { tobeDeleted = a; break; } //if account record found delete it if (tobeDeleted != null) { Delete tobeDeleted; } //refresh the data getTypeTasks(); } public List<TaskForTypes__c> getUniqueTypes(){ List<TaskForTypes__c> types = [SELECT Sub_Type_Name__c FROM TaskForTypes__c]; return types; } }
and my VF page code is
<apex:page controller="newTaskForTypeController" tabStyle="TaskForTypes__c" > <script> function confirmCancel() { var isCancel = confirm("Are you sure you wish to cancel?"); if (isCancel) return true; return false; } </script> <apex:sectionHeader title="Add New Task Assignment For Types Rule"/> <apex:form > <apex:pageBlock title="Rule Name" mode="edit"> <apex:pageBlockButtons > <apex:commandButton action="{!save}" value="Save & Next" /> <apex:commandButton action="{!cancel}" value="Cancel" onclick="return confirmCancel()" immediate="true" /> </apex:pageBlockButtons> <apex:pageBlockSection > <apex:inputField id="subtype" value="{!typeOfTask.Sub_Type_Name__c}" required="true" /> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
I got an error "Unknown property 'newTaskForTypeController.typeOfTask'".
any help please
public TaskForTypes__c typeOfTask{get;set;}
Let us know if this will help you
Thanks
Amit Chaudhary
As you are using
It shoulbe a getter to the Controller.
Hope this will be helpful.Thanks,
Abhishek