You need to sign in to do that
Don't have an account?
raki
whats wrong in this code(Error: Invalid field ischecked for SObject Sample_Item__c )
Hi, I dont know whats wrong in this code im getting this error msg
Error: Invalid field ischecked for SObject Sample_Item__c
class:
public with sharing class sampleitem { public PageReference doSelect() { List<sample_Item__c> lstswi = new List<sample_Item__c>(); for(wrapperSample objws : lstWS){ if(objws.ischecked == true){ objws.swi.Item__c = pid; update objws.swi; } } return (new pagereference('/'+pid).setredirect(true)); } public String pId = apexpages.currentpage().getparameters().get('pid'); public String wtId = apexpages.currentpage().getparameters().get('wid'); public List<sample_Item__c> lstSWI{get;set;} public wrapperSample objWS{get;set;} public List<wrapperSample> lstWS{get;set;} public sampleitem(){ lstSWI = new List<sample_Item__c>(); lstSWI = new List<sample_Item__c>(); lstSWI = [select id,name,Stage__r.Name,Item__r.name from sample_Item__c where Template__c =: wtId]; lstWS = new List<wrapperSample>(); for(sample_Item__c objSWI : lstSWI){ objWS = new wrapperSample(); objWS.swi = objSWI; lstWS.add(objWS); } } public class wrapperSample{ public sample_Item__c swi{get;set;} public boolean ischecked{get;set;} }
page
<apex:page controller="sampleitem"> <apex:form > <apex:pageblock > <apex:pageblocksection > <apex:pageblocktable value="{!lstWS}" var="S"> <apex:column headerValue="Select"> <apex:inputcheckbox value="{!S.ischecked}"/> </apex:column> <apex:column headerValue="Name"> <apex:outputtext value="{!S.swi.Name}"></apex:outputtext> </apex:column> <apex:column headerValue="Stage"> <apex:outputtext value="{!S.swi.Stage__r.Name}"></apex:outputtext> </apex:column> <apex:column headerValue="Item Name"> <apex:outputtext value="{!S.swi.Item__r.name}"></apex:outputtext> </apex:column> </apex:pageblocktable> </apex:pageblocksection> <apex:commandButton value="Select" Action="{!doSelect}"/> </apex:pageblock> </apex:form>
If you have a custom field called "ischecked" you might have to add __c after it.
-hkp716
it is not a custom field i am putting checkbox in vf page