Jump to:

5520 Posts in 1734 Topics by 1223 members

Customising the CMS

SilverStripe Forums » Customising the CMS » HTMLEditorField

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

Page: 1
Go to End
Author Topic: 1550 Views
  • PGiessler
    Avatar
    Community Member
    47 Posts

    HTMLEditorField Link to this post

    Hi,

    I'm writing a module to extend SilverStripe. In the module I create serveral form fields (TextField, TextareaField and so on). Furthemore I can save everything into my MySQL database. But there is a problem: I can't save the modified content of an HTMLEditorField. If I edit manually the HTML content in the database, it will displayed without any problems. But in the CMS Backend no chance, the content will ignored. The database array field is set to 'HTMLText'. So this isn't the problem.

    My function getEditForm($id) return form. The AJAX request works! So I looked into the requested object and there is no value of the form field with the HTML text. If I changed the HTMLEditorField into a TextareaField everything works and the content will updated in the database. So my question is why does the requested object doesn't have the value of a form field of type HTMLEditorField.

    Best regards,

    Pascal

  • Willr
    Avatar
    Forum Moderator
    5490 Posts

    Re: HTMLEditorField Link to this post

    Is your database field a 'HTMLText' field?

  • PGiessler
    Avatar
    Community Member
    47 Posts

    Re: HTMLEditorField Link to this post

    Yes, my database field is a HTMLText. If I don't set this type, I will get a error in the function saveInto() on the class HTMLEditorField
    So this isn't the reason for my problem. I hope you have another solution.

  • Ingo
    Avatar
    Forum Moderator
    801 Posts

    Re: HTMLEditorField Link to this post

    > But there is a problem: I can't save the modified content of an HTMLEditorField

    So no content is saved at all? Or saved as escaped HTML instead of raw? Does the data get submitted with the POST ajax request? (you can check this with getfirebug.com). Keep in mind that in case you're using some custom TinyMCE or otherWYSIWYG formfield thats not a plain HTMLEditorField, you'll likely need to tell the editor via JavaScript to extract the HTML *before* saving.

    1550 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.