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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Data Model Questions /

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

HTMLText not displaying as HTMLField


Go to End


7 Posts   2726 Views

Avatar
Phill

Community Member, 81 Posts

7 October 2010 at 5:28am

Edited: 07/10/2010 5:36am

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

Community Member, 10 Posts

11 October 2010 at 11:40pm

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

Avatar
swaiba

Forum Moderator, 1899 Posts

11 October 2010 at 11:43pm

Edited: 12/10/2010 1:24am

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

Community Member, 10 Posts

12 October 2010 at 1:20am

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

Avatar
swaiba

Forum Moderator, 1899 Posts

12 October 2010 at 1:24am

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

Avatar
swaiba

Forum Moderator, 1899 Posts

4 June 2011 at 1:10am

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

Community Member, 400 Posts

8 June 2011 at 11:09pm

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