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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Customising the CMS /

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

How to add HtmlEditorField


Go to End


2 Posts   1578 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