I am trying to create a frontend form containing an HTMLEditorField. I have set up the form fields as below
$description = new HtmlEditorField('Description');
$description->setRows(10);
$fields = new FieldList(new TextField('Title', 'Job Title'),
new TextField('JobType','Type'),
new DateField('ClosingDate','Closing Date'),
new TextField('Reference'),
new TextField('ContactName','Contact'),
new EmailField('ContactEmail','Email'),
$description);
and created the database table for the corresponding DataObject to include a corresponding HTMLText field
class JobVacancy extends DataObject
{
static $db = array(
'Title' => 'Text',
'JobType' => 'Text',
'ClosingDate' => 'Date',
'Reference' => 'Text',
'ContactName' => 'Text',
'ContactEmail' => 'Text',
'Description' => 'HTMLText'
);
}
The form is rendered as expected in that it contains the description field as follows
<div id="Description" class="field htmleditor">
<label class="left" for="Form_CreateVacancyForm_Description">Description</label>
<div class="middleColumn">
<textarea name="Description" value="" class="htmleditor" id="Form_CreateVacancyForm_Description" rows="10" cols="10" tinymce="true" style="width: 97%; height: 160px"></textarea>
</div>
</div>
and the entire form appears like the attached image.
I am expecting this type of field to behave on my frontend form exactly the same way it does when I use this type of field on a tab in the CMS, consequently I have two problems:
Problem 1: On submission, the record is created but the content of the HTMLText field is the same as the text entered in the form, that is plain text rather than the expected HTML markup. If I include markup directly to the field the record contains the markup I entered. Is this expected behaviour?
Problem 2: There is no TinyMCE toolbar visible. Do I need to configure the page to display this? Is the absence of the TinyMCE toolbar related to Problem 1?
I appreciate any assistance understanding and hopefully resolving this issue.
Thanks