• MananShah
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Hello,
I've got some Visualforce pages that use controllers which contain describe calls to get picklist values. The picklist values are being used to populate Google visualizaition API data.

Any time I add an <apex:form> tag to the Visualforce, the page returns:
System.SerializationException: Not Serializable: Schema.DescribeFieldResult

Here are the controller and visualforce. The first VF example works fine, the second returns the error above - the only difference is the form tag.

Controller:

public class myextensioncontroller {

    private final myobject__c myobject;
    public myextensioncontroller(ApexPages.StandardController stdController) {
  this.myobject = (myobject__c)stdController.getRecord();  
    }
 
 Schema.DescribeFieldResult p = myobject__c.mypicklist__c.getDescribe();
 List<Schema.PicklistEntry> stgvals = p.getPicklistValues();


 public List<myobject__c> getmyobjectdata(){
  return [select id, name from myobject__c]; 
 }

}

 
Visualforce that works:
<apex:page standardcontroller="myobject__c" extensions="myextensioncontroller">
   
   <apex:pageblock >
        <apex:pageblocktable value="{!myobjectdata}" var="myobj">
            <apex:column value="{!myobj.name}"/>
        </apex:pageblocktable>
    </apex:pageblock>  
    
</apex:page>

 Visualforce that returns serialization error:
<apex:page standardcontroller="myobject__c" extensions="myextensioncontroller">
   
   <apex:form></apex:form>

   <apex:pageblock >
        <apex:pageblocktable value="{!myobjectdata}" var="myobj">
            <apex:column value="{!myobj.name}"/>
        </apex:pageblocktable>
    </apex:pageblock>  
    
</apex:page>

 
This is causing me a lot of headaches because I can't use commandlink or commandbutton - does anyone see what the problem is? Is this a bug or am I doing something wrong?