Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

HtmlEditorField Problem


Reply


2 Posts   497 Views

Avatar
Possibles

Community Member, 16 Posts

15 March 2012 at 4:50am

Edited: 15/03/2012 4:59am

Hello

I have this problem :

I have created a HtmlEditorField (see code below)
The field is there accordin to database plumber but when I save some content in it the content just disapears and is not saved but i dont get any error it says 'saved'.

Any idea ?

class ArtistePage extends Page
{

   static $has_one = array(
      'ArtistePortrait' => 'Image',
    'ArtisteBio'=> 'File',
      'ArtistText' => 'HTMLText',
    'ArtistePresse'=> 'File'
   );

   static $many_many = array(      
      'Oeuvres' => 'Oeuvre'
   );

   static $allowed_children = array(
      'none' => 'none'
   );
   
   function getCMSFields()
   {
      $fields = parent::getCMSFields();
      
      //Portrait Images
      $fields->addFieldToTab("Root.Content.Portrait", new ImageField('ArtistePortrait', 'Portrait', Null, Null, Null, 'Uploads/Artiste_Portraits'));
      $fields->addFieldToTab("Root.Content.ArtisteBio", new FileUploadField('ArtisteBio', 'UploadArtiste Bio'));
      $fields->addFieldToTab("Root.Content.ArtistePresse", new FileUploadField('ArtistePresse', 'Upload Artiste Presse'));
      $fields->addFieldToTab('Root.Content.Artist Texte', new HtmlEditorField('ArtistText'));
      return $fields;
   }   
}

Thanks

Avatar
Juanitou

Community Member, 323 Posts

15 March 2012 at 5:54am

Hi!

You’re mixing has_one relationships and db fields. Your ArtistText field should go into the $db array. Look at the tutorials and you’ll get it quickly.

Hope it helps,
Juan