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.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

SimpleHTMLEditorField doesnt use paragraph tags?

Go to End

4 Posts   2133 Views


Community Member, 103 Posts

23 September 2010 at 3:18am

Maybe this is normal, but the SimpleHTMLEditorField I'm using does not generate p tags. It surrounds the text by divs instead, which makes the text entered in this field look different from everywhere else that the normal tinymce wysiwyg field is used.

Anybody know a work around or a fix for this? Here is how I am defining and using the field in the template:


class UsedEquip extends DataObject{
    static $db = array (
        'Name' => 'Varchar(255)',
        'Description' => 'HTMLText',
        'Material' => "Enum('Mild Steel,Stainless Steel','Mild Steel')",
        'Tanks' => 'Text',
        'MaterialHandling' => "Enum('Conveyor,Drum,Monorail','Conveyor')",
        'URLSegment' => 'Varchar(255)'
    static $has_one = array (
        'UsedEquipPage' => 'UsedEquipPage',
        'Photo' => 'Image'
    public function getCMSFields_forPopup()
        return new FieldSet(
            new TextField('Name','Name'),
            new SimpleHTMLEditorField('Description'),
            new DropdownField(
                $name = "Material",
                $title = "Made From",
                $source = singleton('UsedEquip')->dbObject('Material')->enumValues()
            new TextField('Tanks','No. of Tanks'),
            new DropdownField(
                $name = "MaterialHandling",
                $title = "Material Handling",
                $source = singleton('UsedEquip')->dbObject('MaterialHandling')->enumValues()
            new SimpleImageField('Photo')
    function Thumbnail() {
        $Photo = $this->Photo();
        if ( $Photo ) {
            return $Photo->CMSThumbnail();
        } else {
            return null;
    public function onBeforeWrite(){
            $this->URLSegment = SiteTree::GenerateURLSegment($this->Name);
            if($object = DataObject::get_one($this->ClassName, "URLSegment='" .$this->URLSegment 
            ."' AND ID !=".$this->ID)){
                $this->URLSegment = $this->URLSegment.'-'.$this->ID;
           // else {
                //$this->URLSegment = SiteTree::GenerateURLSegment($this->ClassName.'-'.$this->ID);

Template Snippet:

<% control IndividualEquip %>
        <div id="UsedImage">
        <div id="Overview" class="typography">
                <li>Name: $Name</li>
                <li>Construction: $Material</li>
                <li>Material Handling: $MaterialHandling</li>
                <li>Number of Tanks: $Tanks</li>
        <div id="Description" class="typography">
    <% end_control %>   



Community Member, 156 Posts

23 September 2010 at 8:07pm

Just wanted to say I am experiencing this issue also and wondered if there was a fix.

It only seems to happen when you format within the wysiwyg. If my clients paste in raw text from notepad it formats correctly.


Community Member, 156 Posts

23 September 2010 at 8:46pm

Try SimpleTinyMCEField rather than SimpleHTMLEditorField


Community Member, 103 Posts

24 September 2010 at 6:35am

SimpleTinyMCEField was a perfect solution for that problem... Thank you!