You need to sign in to do that
Don't have an account?
Error: Unknown property 'testWrapper.materialWrapper.select'
Afternoon All,
I am trying to save my VF page but i am getting the following error "Error: Unknown property 'testWrapper.materialWrapper.select' ".
Aim - The user will go to the sales_and_marketing__c object ,scroll down to the Materials_Junction related list. click "new", this should then call the VF page listed below. and return all the records from the Materials object which are active (Crtieria in Class). The user then selects the Materials, fills in quantity. When the User Saves this should then be mapped back to the sales_and_marketing__c object
Really appreciate your help
I have the following Controller :
public with sharing class testWrapper { public List<Materials__c> Materials {get;set;} public List<materialWrapper> materialWrapperList {get;set;} public testWrapper() { Materials = [select ID,name,Product__c, Item__c,Quanity__c, Active__c from Materials__c where Active__c =true limit 10]; for(Materials__c obj : Materials) { materialWrapper tempObj= new materialWrapper(); tempObj.recordId = obj.id; tempObj.name = obj.name; tempObj.product = obj.Product__c; tempObj.item = obj.Item__c; tempObj.quantity = obj.Quanity__c; tempObj.selectB = false; materialWrapperList.add(tempObj); } } //save method public void save() { list<Materials_Junction__c> recordToInsert = new list<Materials_Junction__c>(); for(materialWrapper obj : materialWrapperList) { Materials_Junction__c temp ; if(obj.selectB == true) { temp = new Materials_Junction__c(); temp.sales_and_marketing__c = '01I20000000rV6V'; temp.Materials__C= obj.recordId; temp.quantity__C = obj.quantity; } recordToInsert.add(temp); } insert recordToInsert; } public class materialWrapper { public string recordId {get; set;} public string name {get; set;} public string product {get; set;} public string item {get; set;} public Decimal quantity {get; set;} public boolean selectB {get; set;} public void materialWrapper() { recordId = ''; name = ''; product = ''; item = ''; quantity = 0.0; selectB = false; } } }
Visual Force Page :
apex:page controller="testWrapper"> <apex:form > <apex:pageBlock title="Select Product"> <apex:pageBlockButtons > <apex:commandButton value="Save" action="{!save}"/> </apex:pageBlockButtons> <apex:pageBlockTable value="{!materialWrapperList}" var="MKT"> <apex:column value="{!MKT.select}"/> <apex:column value="{!MKT.name}"/> <apex:column value="{!MKT.Product}"/> <apex:column value="{!MKT.Item}"/> <apex:column headerValue="Quanity"> <apex:inputField value="{!MKT.Quanity}"/> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:form>
i have updated you code. should work for you.
All Answers
It seems that you have missed 'B'
Replace this
<apex:column value="{!MKT.select}"/>
with the below
<apex:column value="{!MKT.selectB}"/>
Should work now.
Hi Magesh,
Updated VF page to
But i know get ' Error: Could not resolve the entity from <apex:inputField> value binding '{!MKT.Quanity}'. <apex:inputField> can only be used with SObjects, or objects that are Visualforce field component resolvable.'
replace 'Quanity' with 'quantity'
HI Magesh,
Still the same error "Error: Could not resolve the entity from <apex:inputField> value binding '{!MKT.quantity}'. <apex:inputField> can only be used with SObjects, or objects that are Visualforce field component resolvable."
the MKT.quantity is a variable not the sobject filed so you need to use <apex:inputText value={!MKT.quantity} /> instead of <apex:inputField>
HI Magesh,
Its allowed me to save the visual force page. When i click on the "preview" button i get the following error
System.NullPointerException: Attempt to de-reference a null object
Class.testWrapper.<init>: line 18, column 1
Do you have 5mins so we can discuss ?
In the constructor you need to declare "materialWrapperList"
like this
materialWrapperList = new List<materialWrapper>();
Do you have 5 mins to go through this ? I am a little confused .
i have updated you code. should work for you.