function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Pun!5h3rPun!5h3r 

Use of Form tag gives error

Vf Page
<apex:page controller="MatrixController" showHeader="false">
            <apex:form>
            <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: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