Jump to:

5542 Posts in 1739 Topics by 1225 members

Customising the CMS

SilverStripe Forums » Customising the CMS » How to add HtmlEditorField

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

Page: 1
Go to End
Author Topic: 1007 Views
  • hunman
    Avatar
    Community Member
    18 Posts

    How to add HtmlEditorField Link to this post

    I have created a new module for CMS, I am adding HtmlEditorField like this:

    $fields = new FieldSet(
             // TODO The ID field needs to be hidden but while testing make it readonly
             new ReadonlyField('ID','id #',$id),
             new TextField('article_name', "Article Name", ""),
             $dateField = new DateField('article_date', "Article Date", ""),
             new CheckboxField('article_publish',"Publish",""),
             new CheckboxField('article_archive',"Archive",""),
             new HtmlEditorField('article_content', "Content",15,20)
             
          );

    and created dataobject like this:

    class Articles extends DataObject {
       static $db = array(
          'article_name' => 'Varchar',
          'article_date' => 'Date',
          'article_publish' => 'Boolean',
          'article_archive' => 'Boolean',
          'article_content' => 'HTMLText'
             
       );

    }

    But when I submit my form, I get the validation error "article_content Content Required" even though I have fed all the fields with data , if I remove the validation, the form is submitted but the data(from HtmlEditorField) is not saved to the database ??

    Please note that the same form works fine when I replace HtmlEditorField with TextareaField.

    How can I get the HtmlEditorField working?

  • hunman
    Avatar
    Community Member
    18 Posts

    Re: How to add HtmlEditorField Link to this post

    Hello,

    Someone there, can anyone throw some light on this issue, I got stuck up in this.

    Thanks

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