Jump to:

5514 Posts in 1733 Topics by 1219 members

Customising the CMS

SilverStripe Forums » Customising the CMS » HELP! HTMLText field not displaying in CMS :(

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

Page: 1
Go to End
Author Topic: 2226 Views
  • Radweb
    Avatar
    18 Posts

    HELP! HTMLText field not displaying in CMS :( Link to this post

    Hi all,

    Having trouble trying to a get WYSIWYG field working on my job postings board... When I use a Textareafield its loads okay but I have to manually type HTML fields. .. I'm looking to get a basic HTML editor in there with just the common text formatting. Followed instructions to this point:

    class JobBoard extends DataObject {
       static $db = array(
          'JobTitle' => 'Varchar',
          'JobDescription' => 'HTMLText', // Declared HTMLText when building the custom database table

    $fields = new FieldSet(

       new ReadonlyField('ID','id #',$id),
       new TextField('JobTitle', 'Job Title', 'New Job'),
       new HtmlEditorField("JobDescription", "Job Description"), // Declared HTMLEditor field (but shows nothing in CMS)

    $form->loadDataFrom(array(
       'ID' => $currentJob->ID,
       'JobTitle' => $currentJob->JobTitle,
       'JobDescription' => $currentJob->JobDescription, // Load data into it - which works fine on Textareafield

    Fresh pair of eyes would be very much appreciated;

    I'm using silverstripe 2.2.2.

    Cheers

    Steve

  • Artyom
    Avatar
    Community Member
    22 Posts

    Re: HELP! HTMLText field not displaying in CMS :( Link to this post

    I just did the following and it worked.

    class HomePage extends Page {

       public static $has_one = array(
          'HomePageText1' => 'HTMLText',
    // ...
       );

       function getCMSFields() {
          $fields = parent::getCMSFields();

          $fields->addFieldToTab("Root.Content.HomePageTextAreas", new HtmlEditorField('HomePageText1', 'HomePageText1'));

          return $fields;
       }
    }

    I think it might have something to do with the fact that you are assigning

    $fields = new FieldSet(...);

    Rather then adding to the array.

    2226 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.