You need to sign in to do that
Don't have an account?
Pun!5h3r
Use of <Form> tag gives Error
vf page
as soon as i add form tag to vf. it gives following error
" System.SerializationException: Not Serializable: com/salesforce/api/fast/List$$lcom/salesforce/api/Schema/PicklistEntry$$r "
Thanks
<apex:page controller="MatrixController" showHeader="false"> <table style="height: 100%;width: 100%;background-color: snow;" > <tr> <apex:repeat value="{!listHeader}" var="header"> <th style="width:25%;"> {!header} </th> </apex:repeat> </tr> <apex:repeat value="{!listMatrix}" var="Wrapper"> <tr> <td>{!Wrapper.Name}</td> <apex:repeat value="{!Wrapper.listOpportunity}" var="Opportunity"> <td> <input type="text" pattern="[0-9]+" value="{!Opportunity.Amount}"/> </td> </apex:repeat> </tr> </apex:repeat> </table> <apex:form> <apex:CommandButton title="rahim"/> </apex:form> </apex:page>Controller
public class MatrixController { public List<Schema.PicklistEntry> lstMonth{get; set;} public List<Schema.PicklistEntry> lstType{get; set;} public List<String> listMonth{get; set;} public List<String> listType{get; set;} public List<String> listHeader{get; set;} public List<WrapperMatrix> listMatrix{get; set;} private List<Opportunity> listOpportunity; private Map<String,Opportunity> mapOpportunity; public MatrixController(){ listMonth = new List<String>(); listType = new List<String>(); listHeader = new List<String>(); listMatrix = new List<WrapperMatrix>(); mapOpportunity = new Map<String,Opportunity>(); Schema.DescribeFieldResult fieldResultMonth = Opportunity.Month__c.getDescribe(); lstMonth = fieldResultMonth.getPicklistValues(); fieldResultMonth = Opportunity.Type__c.getDescribe(); lstType= fieldResultMonth.getPicklistValues(); for(Schema.PicklistEntry objPicklistEntry : lstMonth ){ String strMonth = objPicklistEntry.getLabel(); listMonth.add(strMonth); } for(Schema.PicklistEntry objPicklistEntry : lstType ){ String strType = objPicklistEntry.getLabel(); listType.add(strType); } listOpportunity = [SELECT Id, Month__c, Type__c, Amount FROM Opportunity WHERE Month__c != NULL ORDER BY Month__c, Type__c]; for(Opportunity objOpportunity : listOpportunity) { mapOpportunity.put(objOpportunity.Month__c + ',' + objOpportunity.Type__c , objOpportunity); } system.debug(mapOpportunity); for(String strMonth : listMonth){ WrapperMatrix objWrapperMatrix = new WrapperMatrix(); objWrapperMatrix.Name = strMonth ; for(String strType : listType){ if(mapOpportunity.ContainsKey(strMonth + ',' + strType)) { objWrapperMatrix.listOpportunity.add(mapOpportunity.get(strMonth + ',' + strType)); } else { objWrapperMatrix.listOpportunity.add(new Opportunity()); } } listMatrix.add(objWrapperMatrix); } system.debug(listMatrix); listHeader.add('Month/Type'); for(String strHeader : listType) { listHeader.add(strHeader); } } public class WrapperMatrix{ public String Name{get; set;} public List<Opportunity> listOpportunity{get; set;} public WrapperMatrix () { //Amount = (Integer)objOpportunity.Amount; listOpportunity = new List<Opportunity>(); } } }in the above code i want to use commandButton, but to use commandButton we need to write it inside <form> tag .
as soon as i add form tag to vf. it gives following error
" System.SerializationException: Not Serializable: com/salesforce/api/fast/List$$lcom/salesforce/api/Schema/PicklistEntry$$r "
Thanks
Try put the tag <form> under the tag <page> to cover all code.
I think you have to use a PageReference return method too