Jump to:

23006 Posts in 11856 Topics by 2828 members

General Questions

SilverStripe Forums » General Questions » HtmlEditorField Problem

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

Page: 1
Go to End
Author Topic: 423 Views
  • Possibles
    Avatar
    Community Member
    16 Posts

    HtmlEditorField Problem Link to this post

    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

  • Juanitou
    Avatar
    Community Member
    322 Posts

    Re: HtmlEditorField Problem Link to this post

    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

    423 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.