You need to sign in to do that
Don't have an account?
Chris Tribanas 3
Keep getting error for Visualforce Page -- Need help
I am trying to create a visualforce page that allows people to edit many child objects from the parent object. In this instance, our org will have a Project (Project__c) as the parent and then many Work Orders (work_order__c) related to that Project. Since most projects will have around 200 Work Orders, it would be cumbersome for somebody to edit them one by one.
The error I keep getting is: Unkown property 'Project__cStandardController.Work_Orders'. I am not a developer so any help would be much appreciated. Thank you!
Here is my controller:
public class workorderController {
// Constructor
public workorderController(ApexPages.StandardController controller) {
this.proj = (Project__c)controller.getSubject();
this.delivers = [ SELECT
d.SystemModstamp, d.Name,
d.LastModifiedDate, d.LastModifiedById, d.LastActivityDate,
d.IsDeleted, d.Id, d.CreatedDate, d.CreatedById,
d.AFE__c, d.Service__c, d.Project_Manager__c, d.work_order_status__c,
d.Service_provider__c
FROM
Work_order__c d
WHERE
d.AFE__c = :proj.id ];
}
// Action Method called from page button
public pagereference saveChanges() {
upsert this.delivers;
return null;
}
// Action Method called from page link
public pagereference newDeliverable() {
work_order__c d = new work_order__c();
d.AFE__c =this.proj.id;
delivers.add( d );
return null;
}
// public Getter to provide table headers
public string[] getheaders() { return new string []
{'Name','Service','Work Order Status','Project Manager', 'Service Provider',
'AFE' } ; }
// public Getter to list project deliverables
public work_order__c[] getWorkOrders() {
return this.delivers;
}
// class variables
Project__c proj;
work_order__c[] delivers;
}
My VF Page:
<apex:page standardController="Project__c" extensions="workorderController">
<style>
.pbBody td {
border-color: #E3DEB8;
border-style: none none solid;
border-width: medium medium 2px;
padding-bottom: 4px;
padding-top: 4px;
width: 85px;
}
.pbBody input { width: 105px;}
.pbBody .nameColumn { width: 125px;}
.hdr {;}
</style>
<apex:form>
<apex:messages />
<apex:sectionHeader title="Work Orders for" subtitle="{!Project__c.name}" />
<apex:pageBlock title="Edit Work Orders">
<apex:pageBlockButtons>
<apex:commandButton action="{!saveChanges}" value="Save"
rerender="main" status="ajaxStatus" />
<apex:commandButton action="{!cancel}" value="Cancel" />
</apex:pageBlockButtons>
<apex:actionStatus id="ajaxStatus" startText="Updating Work Orders...">
<apex:facet name="stop">
<apex:outputPanel id="main">
<table>
<tr>
<apex:repeat value="{!headers}" var="h">
<td class="hdr">{!h}</td>
</apex:repeat>
</tr>
<apex:repeat value="{!Work_Orders}" var="a">
<tr>
<td ><apex:inputField value="{!a.name}" /></td>
<td><apex:inputField value="{!a.Service__c}" /></td>
<td><apex:inputField value="{!a.Work_Order_Status__c}" /></td>
<td><apex:inputField value="{!a.Project_Manager__c}" /></td>
<td><apex:inputField value="{!a.Service_Provider__c}" /></td>
<td><apex:inputField value="{!a.AFE__c}" /></td>
</tr>
</apex:repeat>
</table>
</apex:outputPanel>
</apex:facet>
</apex:actionStatus>
</apex:pageBlock>
</apex:form>
</apex:page>
The error I keep getting is: Unkown property 'Project__cStandardController.Work_Orders'. I am not a developer so any help would be much appreciated. Thank you!
Here is my controller:
public class workorderController {
// Constructor
public workorderController(ApexPages.StandardController controller) {
this.proj = (Project__c)controller.getSubject();
this.delivers = [ SELECT
d.SystemModstamp, d.Name,
d.LastModifiedDate, d.LastModifiedById, d.LastActivityDate,
d.IsDeleted, d.Id, d.CreatedDate, d.CreatedById,
d.AFE__c, d.Service__c, d.Project_Manager__c, d.work_order_status__c,
d.Service_provider__c
FROM
Work_order__c d
WHERE
d.AFE__c = :proj.id ];
}
// Action Method called from page button
public pagereference saveChanges() {
upsert this.delivers;
return null;
}
// Action Method called from page link
public pagereference newDeliverable() {
work_order__c d = new work_order__c();
d.AFE__c =this.proj.id;
delivers.add( d );
return null;
}
// public Getter to provide table headers
public string[] getheaders() { return new string []
{'Name','Service','Work Order Status','Project Manager', 'Service Provider',
'AFE' } ; }
// public Getter to list project deliverables
public work_order__c[] getWorkOrders() {
return this.delivers;
}
// class variables
Project__c proj;
work_order__c[] delivers;
}
My VF Page:
<apex:page standardController="Project__c" extensions="workorderController">
<style>
.pbBody td {
border-color: #E3DEB8;
border-style: none none solid;
border-width: medium medium 2px;
padding-bottom: 4px;
padding-top: 4px;
width: 85px;
}
.pbBody input { width: 105px;}
.pbBody .nameColumn { width: 125px;}
.hdr {;}
</style>
<apex:form>
<apex:messages />
<apex:sectionHeader title="Work Orders for" subtitle="{!Project__c.name}" />
<apex:pageBlock title="Edit Work Orders">
<apex:pageBlockButtons>
<apex:commandButton action="{!saveChanges}" value="Save"
rerender="main" status="ajaxStatus" />
<apex:commandButton action="{!cancel}" value="Cancel" />
</apex:pageBlockButtons>
<apex:actionStatus id="ajaxStatus" startText="Updating Work Orders...">
<apex:facet name="stop">
<apex:outputPanel id="main">
<table>
<tr>
<apex:repeat value="{!headers}" var="h">
<td class="hdr">{!h}</td>
</apex:repeat>
</tr>
<apex:repeat value="{!Work_Orders}" var="a">
<tr>
<td ><apex:inputField value="{!a.name}" /></td>
<td><apex:inputField value="{!a.Service__c}" /></td>
<td><apex:inputField value="{!a.Work_Order_Status__c}" /></td>
<td><apex:inputField value="{!a.Project_Manager__c}" /></td>
<td><apex:inputField value="{!a.Service_Provider__c}" /></td>
<td><apex:inputField value="{!a.AFE__c}" /></td>
</tr>
</apex:repeat>
</table>
</apex:outputPanel>
</apex:facet>
</apex:actionStatus>
</apex:pageBlock>
</apex:form>
</apex:page>
<apex:repeat value="{!Work_Orders}" var="a">
to ..
<apex:repeat value="{!WorkOrders}" var="a">
All Answers
<apex:repeat value="{!Work_Orders}" var="a">
to ..
<apex:repeat value="{!WorkOrders}" var="a">