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.

Data Model Questions

HTMLText not displaying as HTMLField


Reply

7 Posts   1742 Views

Avatar
Phill

7 October 2010 at 5:28am (Last edited: 7 October 2010 5:36am), Community Member, 75 Posts

Hi

I have a problem with a HTMLText data type being displayed in a text field instead of a editable html field. The problem only occurs when the field is being displayed in a pop-up field.

Any ideas on what might be causing this issue? I've posted the code used to re-create the problem below.

class TestAdminTree extends ModelAdmin
{
static $managed_models = array('TreeParentObject');

static $url_segment = 'testtreeadmin';
static $menu_title = 'TestTree Admin';
}

class TreeParentObject extends DataObject
{
static $db = array('Name' => 'Text');

static $has_many = array('TreeChildObject' => 'TreeChildObject');
}

class TreeChildObject extends DataObject
{
static $db = array('HT' => 'HTMLText');

static $has_one = array('TreeParentObject' => 'TreeParentObject');
}

Thanks
phil

Avatar
Bauer-CTU

11 October 2010 at 11:40pm Community Member, 10 Posts

Not sure I've understood this correctly Phil - can you post your code for function getCMSFields() ?

Avatar
swaiba

11 October 2010 at 11:43pm (Last edited: 12 October 2010 1:24am), Forum Moderator, 1796 Posts

Hi Bauer,

FYI the field is automatically scaffolded into a HTMLField (as you can see if you add TreeChildObject to the managed models)... so there is no need to override the getCMSFields to reproduce this...

static $managed_models = array('TreeParentObject','TreeChildObject');

Avatar
Bauer-CTU

12 October 2010 at 1:20am Community Member, 10 Posts

Oh ok. Thanks for the info swaiba. I'm a bit of a SS newbie.

Avatar
swaiba

12 October 2010 at 1:24am Forum Moderator, 1796 Posts

No worries, I'm just interested in an answer here also!

Avatar
swaiba

4 June 2011 at 1:10am Forum Moderator, 1796 Posts

I know CTF is going to die soon, but please can anyone help with a solution to using TinyMCE in a CTF has_one / has_many popup please?
(see attached image if there is any confusion)

Attached Files
Avatar
Nivanka

8 June 2011 at 11:09pm Community Member, 395 Posts

are you using this within an ComplexTableField?

if so I think the best might be specify the popUpFiled types for the table field.

new ComplexTableField($this, $name, $sourceClass, $fieldList = null, $detailFormFields = new FieldSet( new TextField('HT'); ) )

this might work, and if you still need a WYSIWYG editor on the popup you can use some of the goodies which ships with the DataObjectManagerModule of unclecheese