You need to sign in to do that
Don't have an account?
Karthikeyan Kannan
Error: Unknown property 'InlineTechnicianController.TechnicianWrapper.Technician'
Hi ,
I am getting this Error while saving my VF page can anyone tel where I did the mistake and here is my code. Thanks in Advance.
=======PAGE======
<apex:page controller="InlineTechnicianController" id="mypage" sidebar="false">
<apex:form id="form1" >
<apex:pageBlock id="pgBlok" rendered="{!isSaved}">
<apex:pageblockButtons location="top">
<apex:commandButton value="Edit Dates" action="{!editTechDate}" reRender="form1"/>
</apex:pageblockButtons>
<apex:pageBlockSection columns="1">
<apex:pageBlockTable value="{!Technician}" var="tc">
<apex:column headerValue="StartDate"><apex:outputText value="{!tc.StartDate}" ></apex:outputText></apex:column>
<apex:column headerValue="EndDate"><apex:outputText value="{!tc.EndDate}"></apex:outputText></apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
<apex:pageBlock id="pgBlok1" rendered="{!isEdit}">
<apex:pageblockButtons location="top">
<apex:commandButton value="Add Row" action="{!addTechDate}" reRender="form1"/>
<apex:commandButton value="Save Row" action="{!saveTechDate}" reRender="form1"/>
<!-- <apex:commandButton value="Remove Additional Row" action="{!Datesremove}" reRender="pgBlok"/> -->
</apex:pageblockButtons>
<apex:pageBlockSection columns="1">
<apex:pageBlockTable value="{!Technician}" var="tc">
<apex:column headerValue="StartDate"><apex:inputText value="{!tc.StartDate}" size="10" id="demo" onfocus="DatePicker.pickDate(false, this , false);"></apex:inputText></apex:column>
<apex:column headerValue="EndDate"><apex:inputText value="{!tc.EndDate}" size="10" id="demo1" onfocus="DatePicker.pickDate(false, this , false);"></apex:inputText></apex:column>
<apex:column >
<apex:commandLink action="{!doRemove}" value="Remove Row" reRender="form1">
<apex:param name="removeRow" value="{!tc.Technician}" />
</apex:commandLink>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
======CONTROLLER=======
public class InlineTechnicianController
{
//Globally Declared Variables and Properties.
public boolean isEdit {get;set;}
public boolean flag {get;set;}
public boolean isSaved {get;set;}
public Integer rowNum {get;set;}
//Constructor
public InlineTechnicianController() {
isSaved = true;
}
public InlineTechnicianController(ApexPages.StandardController controller)
{
flag=false;
isEdit=false;
isSaved = true;
}
//Wrapper Classes
public class TechnicianWrapper
{
public String StartDate{get;set;}
public String EndDate{get;set;}
}
//Methods
Engineer__c newList= [select Id,Start_Date_Long__c,End_Date_Long__c from Engineer__c where Id=:ApexPages.currentPage().getParameters().get('id')];
public List<TechnicianWrapper> techList = new List<TechnicianWrapper>();
public List<TechnicianWrapper> getTechnician() // For populating Dates
{
if(techList.isEmpty())//Avoids list getting repopulated with same Values over and over again.
{
if(newList.Start_Date_Long__c!=null)// Only if fields from which the data is getting filled are populated.
{
List<String> sdate,edate;
sdate= newList.Start_Date_Long__c.split(';',-1);
for(Integer iterator=0;iterator<sdate.size();iterator++)
{
TechnicianWrapper instance = new TechnicianWrapper();
instance.StartDate = sdate[iterator];
if(newList.End_Date_Long__c!=null )
{
instance.EndDate = edate[iterator];
}else
{
instance.EndDate ='';
}
techList.add(instance);
System.debug('techList====='+techList);
}
}
}
System.debug('techList====='+techList);
return techList;
}
public PageReference editTechDate()
{
isEdit=true;
isSaved = false;
return null;
}
public PageReference addTechDate()
{
TechnicianWrapper instance = new TechnicianWrapper();
techList.add(instance);
return null;
}
public PageReference saveTechDate()
{
Boolean isError=false;
Boolean isError2=false;
Boolean isError3=false;
Boolean isError4=false;
Boolean isError5=false;
String sdt='', edt='';
if(flag)
{
techList = new List<TechnicianWrapper>();
}
// Set<String> avoidDuplicate = new Set<String>();
for(TechnicianWrapper iterator:techList)
{
if(sdt=='')
{
sdt = iterator.StartDate;
edt = iterator.EndDate;
}
else
{
sdt = sdt+';'+iterator.StartDate;
edt = edt+';'+iterator.EndDate;
}
// avoidDuplicate.add(iterator.systemType);
if(iterator.startDate=='')
{
isError3 = true;
}
if(iterator.StartDate!='' && iterator.EndDate=='')
{
isError4 = true;
}
if(iterator.StartDate=='' && iterator.EndDate!='')
{
isError5 = true;
}
}
/*
if(techList.size()!=avoidDuplicate.size())
{
isError2 = true;
}
*/
Engineer__c newList= [select Id,Start_Date_Long__c,End_Date_Long__c from Engineer__c
where Id=:ApexPages.currentPage().getParameters().get('id')];
newList.Start_Date_Long__c = sdt;
newList.End_Date_Long__c = edt;
if(isError)
{
ApexPages.Message myMsg=new ApexPages.Message(ApexPages.Severity.Error, 'Pass and Fail cannot be selected at the same time.');
ApexPages.addMessage(myMsg);
}
else if(isError3)
{
ApexPages.Message myMsg=new ApexPages.Message(ApexPages.Severity.Error, 'Cannot save without Start & End Dates. ');
ApexPages.addMessage(myMsg);
}
else if(isError4)
{
ApexPages.Message myMsg=new ApexPages.Message(ApexPages.Severity.Error, 'Cannot save without End Date');
ApexPages.addMessage(myMsg);
}
else if(isError5)
{
ApexPages.Message myMsg=new ApexPages.Message(ApexPages.Severity.Error, 'Cannot save without Start Date');
ApexPages.addMessage(myMsg);
}
else
{
//try{
update newList;
Engineer__c newList2= [select Id,Start_Date_Long__c,End_Date_Long__c from Engineer__c
where Id=:ApexPages.currentPage().getParameters().get('id') limit 1];
/*}catch(exception e){
ApexPages.Message myMsg=new ApexPages.Message(ApexPages.Severity.Error, e.getMessage());
ApexPages.addMessage(myMsg);
}*/
isEdit=false;
isSaved = true;
}
return null;
}
Public PageReference doRemove()
{
rowNum = Integer.valueOf(apexpages.currentpage().getparameters().get('index'));
techList.remove(rowNum);
return null;
}
}
I am getting this Error while saving my VF page can anyone tel where I did the mistake and here is my code. Thanks in Advance.
=======PAGE======
<apex:page controller="InlineTechnicianController" id="mypage" sidebar="false">
<apex:form id="form1" >
<apex:pageBlock id="pgBlok" rendered="{!isSaved}">
<apex:pageblockButtons location="top">
<apex:commandButton value="Edit Dates" action="{!editTechDate}" reRender="form1"/>
</apex:pageblockButtons>
<apex:pageBlockSection columns="1">
<apex:pageBlockTable value="{!Technician}" var="tc">
<apex:column headerValue="StartDate"><apex:outputText value="{!tc.StartDate}" ></apex:outputText></apex:column>
<apex:column headerValue="EndDate"><apex:outputText value="{!tc.EndDate}"></apex:outputText></apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
<apex:pageBlock id="pgBlok1" rendered="{!isEdit}">
<apex:pageblockButtons location="top">
<apex:commandButton value="Add Row" action="{!addTechDate}" reRender="form1"/>
<apex:commandButton value="Save Row" action="{!saveTechDate}" reRender="form1"/>
<!-- <apex:commandButton value="Remove Additional Row" action="{!Datesremove}" reRender="pgBlok"/> -->
</apex:pageblockButtons>
<apex:pageBlockSection columns="1">
<apex:pageBlockTable value="{!Technician}" var="tc">
<apex:column headerValue="StartDate"><apex:inputText value="{!tc.StartDate}" size="10" id="demo" onfocus="DatePicker.pickDate(false, this , false);"></apex:inputText></apex:column>
<apex:column headerValue="EndDate"><apex:inputText value="{!tc.EndDate}" size="10" id="demo1" onfocus="DatePicker.pickDate(false, this , false);"></apex:inputText></apex:column>
<apex:column >
<apex:commandLink action="{!doRemove}" value="Remove Row" reRender="form1">
<apex:param name="removeRow" value="{!tc.Technician}" />
</apex:commandLink>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
======CONTROLLER=======
public class InlineTechnicianController
{
//Globally Declared Variables and Properties.
public boolean isEdit {get;set;}
public boolean flag {get;set;}
public boolean isSaved {get;set;}
public Integer rowNum {get;set;}
//Constructor
public InlineTechnicianController() {
isSaved = true;
}
public InlineTechnicianController(ApexPages.StandardController controller)
{
flag=false;
isEdit=false;
isSaved = true;
}
//Wrapper Classes
public class TechnicianWrapper
{
public String StartDate{get;set;}
public String EndDate{get;set;}
}
//Methods
Engineer__c newList= [select Id,Start_Date_Long__c,End_Date_Long__c from Engineer__c where Id=:ApexPages.currentPage().getParameters().get('id')];
public List<TechnicianWrapper> techList = new List<TechnicianWrapper>();
public List<TechnicianWrapper> getTechnician() // For populating Dates
{
if(techList.isEmpty())//Avoids list getting repopulated with same Values over and over again.
{
if(newList.Start_Date_Long__c!=null)// Only if fields from which the data is getting filled are populated.
{
List<String> sdate,edate;
sdate= newList.Start_Date_Long__c.split(';',-1);
for(Integer iterator=0;iterator<sdate.size();iterator++)
{
TechnicianWrapper instance = new TechnicianWrapper();
instance.StartDate = sdate[iterator];
if(newList.End_Date_Long__c!=null )
{
instance.EndDate = edate[iterator];
}else
{
instance.EndDate ='';
}
techList.add(instance);
System.debug('techList====='+techList);
}
}
}
System.debug('techList====='+techList);
return techList;
}
public PageReference editTechDate()
{
isEdit=true;
isSaved = false;
return null;
}
public PageReference addTechDate()
{
TechnicianWrapper instance = new TechnicianWrapper();
techList.add(instance);
return null;
}
public PageReference saveTechDate()
{
Boolean isError=false;
Boolean isError2=false;
Boolean isError3=false;
Boolean isError4=false;
Boolean isError5=false;
String sdt='', edt='';
if(flag)
{
techList = new List<TechnicianWrapper>();
}
// Set<String> avoidDuplicate = new Set<String>();
for(TechnicianWrapper iterator:techList)
{
if(sdt=='')
{
sdt = iterator.StartDate;
edt = iterator.EndDate;
}
else
{
sdt = sdt+';'+iterator.StartDate;
edt = edt+';'+iterator.EndDate;
}
// avoidDuplicate.add(iterator.systemType);
if(iterator.startDate=='')
{
isError3 = true;
}
if(iterator.StartDate!='' && iterator.EndDate=='')
{
isError4 = true;
}
if(iterator.StartDate=='' && iterator.EndDate!='')
{
isError5 = true;
}
}
/*
if(techList.size()!=avoidDuplicate.size())
{
isError2 = true;
}
*/
Engineer__c newList= [select Id,Start_Date_Long__c,End_Date_Long__c from Engineer__c
where Id=:ApexPages.currentPage().getParameters().get('id')];
newList.Start_Date_Long__c = sdt;
newList.End_Date_Long__c = edt;
if(isError)
{
ApexPages.Message myMsg=new ApexPages.Message(ApexPages.Severity.Error, 'Pass and Fail cannot be selected at the same time.');
ApexPages.addMessage(myMsg);
}
else if(isError3)
{
ApexPages.Message myMsg=new ApexPages.Message(ApexPages.Severity.Error, 'Cannot save without Start & End Dates. ');
ApexPages.addMessage(myMsg);
}
else if(isError4)
{
ApexPages.Message myMsg=new ApexPages.Message(ApexPages.Severity.Error, 'Cannot save without End Date');
ApexPages.addMessage(myMsg);
}
else if(isError5)
{
ApexPages.Message myMsg=new ApexPages.Message(ApexPages.Severity.Error, 'Cannot save without Start Date');
ApexPages.addMessage(myMsg);
}
else
{
//try{
update newList;
Engineer__c newList2= [select Id,Start_Date_Long__c,End_Date_Long__c from Engineer__c
where Id=:ApexPages.currentPage().getParameters().get('id') limit 1];
/*}catch(exception e){
ApexPages.Message myMsg=new ApexPages.Message(ApexPages.Severity.Error, e.getMessage());
ApexPages.addMessage(myMsg);
}*/
isEdit=false;
isSaved = true;
}
return null;
}
Public PageReference doRemove()
{
rowNum = Integer.valueOf(apexpages.currentpage().getparameters().get('index'));
techList.remove(rowNum);
return null;
}
}
Create Inner class constructor and then make a try.
Thanks for your reply and I have created a Wrapper class varible and it works fine.