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.

Customising the CMS /

How to add HtmlEditorField


Reply


2 Posts   1067 Views

Avatar
hunman

Community Member, 18 Posts

28 February 2011 at 7:34pm

Edited: 28/02/2011 10:36pm

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?

Avatar
hunman

Community Member, 18 Posts

1 March 2011 at 6:00pm

Hello,

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

Thanks