title: Silverstripe - cms fields not saving to database
body: <p>Since moving site to a new server form fields under configuration tab are no longer saving to database. Running same config as old server, SilverStripe 2.3.3 and PHP 5.2.17. Can't see any log or php errors being thrown.</p>
  
  <p>Other fields are saving okay so the problem is specific to this set of fields.</p>
  
  <p>I assume this is the code responsible for the function. Can anyone see any obvious reason this isn't working??</p>
  
  <pre><code>&lt;?php
  
  class Product extends Page {
  
  public static $db = array(
      'ProductIntro' =&gt; 'Text',
      'ProductPrice' =&gt; 'Text',  
      'SpecialOffer' =&gt; 'Boolean',
      'HidePrice' =&gt; 'Boolean',
      'OneMonthPrice' =&gt; 'Currency',
      'ThreeMonthPrice' =&gt; 'Currency',
      'FourMonthPrice' =&gt; 'Currency',
      'SixMonthPrice' =&gt; 'Currency',
      'OutrightPrice' =&gt; 'Currency',
      'DeliveryPrice' =&gt; 'Currency',
      'DefaultPrice' =&gt; 'Enum("OneMonthPrice,ThreeMonthPrice,FourMonthPrice,SixMonthPrice","OneMonthPrice")',
      'VideoEmbedCode' =&gt; 'HTMLText'
  );
  
  public static $has_one = array(
      'ProductImage' =&gt; 'EnhancedImage'
  );
  
  public static $has_many = array(
      'ProductGalleryImages' =&gt; 'ProductGalleryImage',
      'ProductDownloads' =&gt; 'ProductDownload'
  );
  
  public static $many_many = array(
      'RelatedProducts' =&gt; 'Product'                               
  );
  
  static $belongs_many_many = array(
      'IsRelatedProduct' =&gt; 'Product'
  );
  
  
  static $allowed_children = array( );
  
  
  public function getNextSibling() {
  
      return DataObject::get("Product", "ParentID = $this-&gt;ParentID &amp;&amp; Sort &gt; $this-&gt;Sort &amp;&amp; Status = 'Published'", "Sort ASC", null, 1);
  }
  
  public function getPreviousSibling() {
      return DataObject::get("Product", "ParentID = $this-&gt;ParentID &amp;&amp; Sort &lt; $this-&gt;Sort &amp;&amp; Status = 'Published'", "Sort DESC", null, 1);
  }
  
  
  public function SiblingProducts() {
       if ($this-&gt;getField("ParentID")) {
  
          return DataObject::get("Product", "ParentID = " . $this-&gt;getField("ParentID").' AND `SiteTree_Live`.ID != '.$this-&gt;getField("ID"));
      } else return false;
  }
  
  public function SubCategory() {
      if ($this-&gt;getField("ParentID")) {
          return DataObject::get_one("ProductSubCategory", "`SiteTree_Live`.ID = " . $this-&gt;getField("ParentID"));
      } else return false;
  }
  
  public function HasSubCategory() {
      if ($this-&gt;SubCategory()) {
          return true;
      } else {
          return false;
      }
  }
  
  public function Category() {
      if ($this-&gt;HasSubCategory()) {
          $parent_id = $this-&gt;SubCategory()-&gt;getField("ParentID");
      } else {
          $parent_id = $this-&gt;getField("ParentID");
      }
      if ($parent_id) {
          return DataObject::get("ProductCategory", "`SiteTree_Live`.ID = " . $parent_id);
      } else return false;
  }
  
  public function IsFeaturedProduct() {
      $hp = DataObject::get_one("ProductHomepage");
      if ($hp) {
          if ($hp-&gt;FeaturedProduct()) {
              if ($hp-&gt;FeaturedProduct()-&gt;getField('ID') &amp;&amp; $hp-&gt;FeaturedProduct()-&gt;getField('ID') == $this-&gt;getField('ID')) return true;
          }
      }
      return false;
  }
  
  public function IsCategorySpecial() {
  
      if( $this-&gt;parent()-&gt;CategoryFeaturedProductID == $this-&gt;ID ) {
          return true;
      }
  
      return false;
  }
  
  
  function onAfterWrite() {  
  if (isset($_POST['AddedViaObjectManager']) &amp;&amp; $_POST['SetPageToLive'] &amp;&amp; $this-&gt;stagesDiffer('Stage','Live')) {
      $this-&gt;Status = 'Published';
      $this-&gt;Publish('Stage', 'Live');
  }
  parent::onAfterWrite();
  }
  
  function getCMSFields_forPopup() {
    $fields = new FieldSet();
    $fields-&gt;push( new TextField( 'Title', 'Product Title' ) );
    $fields-&gt;push( new TextField( 'ProductIntro', 'Product Intro' ) );
    $fields-&gt;push( new TextField( 'ProductPrice', 'Price ($)' ) );
    $fields-&gt;push( new CheckboxField( 'SpecialOffer', 'This Product is a Special Offer' ) );
    $record = DataObject::get('ProductSubCategory', "");
    if ($record) {
        $map = $record-&gt;toDropDownMap('ID', 'Title');
    } else {
        $map = array();
    }
    $fields-&gt;push( new DropdownField('ParentID','Sub Category',$map) );
    $fields-&gt;push( new SimpleHTMLEditorField( 'Content', 'Content' ));
    $fields-&gt;push( new DropdownField('SetPageToLive','After Update, Set Product Page To:',array('1'=&gt;'Live','0'=&gt;'Draft')) );
    $fields-&gt;push( new FileIFrameField('ProductImage') );
    $fields-&gt;push( new HiddenField('AddedViaObjectManager','AddedViaObjectManager',1) );
    return $fields;
  }
  
  function getCMSFields() {
    $fields = parent::getCMSFields();
  
    $product = new VerticalTabSet(
          new VerticalTab('Configuration',array(
              new LiteralField("ConfDescription","&lt;br /&gt;&lt;em&gt;Product pages support a range of additional features such as pricing.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;"),
              new TextField('ProductIntro', 'Intro Text'),
              new TextField('ProductPrice', 'From Text (Formerly Price)'),
              new CheckboxField("HidePrice","Hide Price"),
              new CheckboxField("SpecialOffer","This Product is currently on special."),
              new LiteralField("ldiv","&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Pricing&lt;/h2&gt;"),
              new CurrencyField("OneMonthPrice", "One Month Hire Price"),
              new CurrencyField("ThreeMonthPrice", "Three Month Hire Price"),
              new CurrencyField("FourMonthPrice", "Four Month Hire Price"),
              new CurrencyField("SixMonthPrice", "Six Month Hire Price"),
              new CurrencyField("OutrightPrice", "Outright Purchase Price"),
              new CurrencyField("DeliveryPrice", "Delivery Price"),
              new DropDownField("DefaultPrice", "Selected Pricing Option", array('OneMonthPrice'=&gt;'1 Month','ThreeMonthPrice'=&gt;'3 Month','FourMonthPrice'=&gt;'4 Month','SixMonthPrice'=&gt;'6 Month'))
          )),
          new VerticalTab('RelatedProducts',array(
              new LiteralField("RelatedDescription","&lt;br /&gt;&lt;em&gt;Related products are displayed on a product page to direct users to other options.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;"),
              new ManyManyDataObjectManager(
                  $this, // Controller
                  'RelatedProducts', // Source name
                  'Product', // Source class
                  array(
                      'Title' =&gt; 'Title'
                  ), // Headings
                  'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
              )
          )),
          new VerticalTab('Images',array(
              new LiteralField("ImageryDescription","&lt;br /&gt;&lt;em&gt;The Main Image is used as the default image for this product.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;"),
              new FileIFrameField('ProductImage', 'Main Image'),
              new LiteralField ("ProdImages",'&lt;br /&gt;&lt;h4 style="margin-bottom:0px;padding-bottom:0px;"&gt;Upload Product Images&lt;/h4&gt;&lt;br /&gt;&lt;em&gt;Supports all image types, however web images are recommended.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;'),
              new ImageDataObjectManager(
                  $this, // Controller
                  'ProductGalleryImages', // Source name
                  'ProductGalleryImage', // Source class
                  'Image', // File name on DataObject
                  array(
                      'Title' =&gt; 'Title'
                  ), // Headings
                  'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
              )
          )),
          new VerticalTab('Downloads',array(
              new LiteralField("ImageryDescription","&lt;br /&gt;&lt;em&gt;Add files users can download.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;"),
              new FileDataObjectManager(
                  $this, // Controller
                  'ProductDownloads', // Source name
                  'ProductDownload', // Source class
                  'File', // File name on DataObject
                  array(
                      'Title' =&gt; 'Title'
                  ), // Headings
                  'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
              )
          )),
          new VerticalTab('Video',array(
              new LiteralField("VideoDescription","&lt;br /&gt;&lt;em&gt;Add the embed code here.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;"),
              new TextareaField('VideoEmbedCode', 'Video Embed Code', 4)
          ))
    );
  
    $product-&gt;setOpenTab('Configuration');
  
    //$fields-&gt;addFieldToTab("Root.Content.Product",$product);
  
    $fields-&gt;insertAfter(new Tab('Configuration',$product),'Main');
  
  
  
    //$fields-&gt;insertAfter(new Tab('Related Products',$product_rel),'Main');
  
  
  
    //$main = $fields-&gt;fieldByName('Main');
  
    //$main-&gt;title = 'Product Details';
  
  
    return $fields;
  }
  
   function HirePrices() {
     $prices = new DataObjectSet();
  
     $keys = array(
       'OneMonthPrice' =&gt; 'One Month',
       'ThreeMonthPrice' =&gt; 'Three Month',
       'FourMonthPrice' =&gt; 'Four Month',
       'SixMonthPrice' =&gt; 'Six Month',
     );
     $f = true;
     foreach($keys as $price_item =&gt; $title) {
         if ($this-&gt;$price_item &gt; 0) {
             $p = $this-&gt;$price_item;
             $prices-&gt;push(new ArrayData( array(
                  'price' =&gt; $p,
                  'nice_price' =&gt; '$'.number_format($p,2),
                  'title' =&gt; $title,
                  'First' =&gt; $f,
                  'IsDefault' =&gt; ($this-&gt;DefaultPrice == $price_item) ? true : false
              )));
             $f = false;
         }
     }
  
     return ($prices) ? $prices : false;
  
  }
  
  }
  
  class Product_Controller extends Page_Controller {
  
  public function init() {
      parent::init();
  
  }
  
  function Category() {
      return $this-&gt;data()-&gt;Category();
  }
  
  function SiblingProducts() {
      return $this-&gt;data()-&gt;SiblingProducts();
  }
  
  
  
  }
  
  ?&gt;
  </code></pre>