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.

Form Questions

3.1 HTMLEditorField in front end form not sending data


Go to End
Reply

16 Posts   1397 Views

Avatar
Vix

23 January 2014 at 7:40pm Community Member, 25 Posts

I have a form on the front end of my site that contains some HTMLEditorFields. In order to get these to work I had to add the following to my template;

<link rel="stylesheet" href="framework/thirdparty/tinymce/themes/advanced/skins/default/ui.css">
<script type="text/javascript" src="framework/thirdparty/tinymce/tiny_mce_gzip.php?m=1378998164&amp;js=1&amp;plugins=contextmenu,table,emotions,paste,spellchecker,media,fullscreen,inlinepopups&amp;themes=advanced&amp;languages=en&amp;diskcache=true&amp;src=false"></script>
<script type="text/javascript" src="framework/javascript/HtmlEditorField.js?m=1378998161"></script>
<script type="text/javascript">      
      tinyMCE.init({
      theme : "advanced",
      mode: "textareas",
      theme_advanced_toolbar_location : "top",
      theme_advanced_buttons1 : "formatselect,|,bold,italic,underline,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,outdent,indent,separator,undo,redo",
      theme_advanced_buttons2 : "",
      theme_advanced_buttons3 : "",
      height:"250px",
      width:"552px"
      });
   </script>

This has allowed the text editor to show up, but when the form is submitted the two textarea fields data does not get sent. If I remove the wysiwyg editor and have plain textareas the data is passed no problem.

Does anyone know if there is something else I need to include to make it function properly? Or if there is a better way to get a HTMLEditorField to work on a front end form?

Avatar
Vix

24 January 2014 at 8:50pm Community Member, 25 Posts

Am I doing something wrong in this forum? No one ever replies to anything I post.

Avatar
thomas.paulson

25 January 2014 at 12:35am (Last edited: 25 January 2014 12:35am), Community Member, 79 Posts

try

<?php
///
class FrontendHtmlEditorField extends HtmlEditorField {

public function __construct($name, $title = null, $value = '') {
parent::__construct($name, $title, $value);
self::include_js();
}

public static function include_js() {
parent::include_js();
Requirements::customScript("ssTinyMceConfig.editor_selector='frontendhtmleditor';tinyMCE.init(ssTinyMceConfig);");
}
}

and replace with below code in Form.
$contentfield = new FrontendHtmlEditorField('Content', _t("ContentEntry.CN",'Content'));

hope it works.

Avatar
Vix

28 January 2014 at 8:12pm Community Member, 25 Posts

Thank you for your response, unfortunately it has not worked.

The text editor still shows nicely, but the data does not pass on when submitted.

I have just made my submit function print out what is in the $data array and the FrontendHtmlEditorField still shows as being empty, but if I make it just a textarea field then it passes the data no problem.

Avatar
thomas.paulson

28 January 2014 at 8:52pm Community Member, 79 Posts

Do you mind sharing the url, you can email me.

Avatar
Vix

29 January 2014 at 3:35pm Community Member, 25 Posts

It is http://ozzy.perthwebdev.com.au/create-an-account/create-a-post and if you select the 'Investors page listing'.

I have left it with just displaying the $data array after it is submitted.

Thank you for your help.

Avatar
thomas.paulson

29 January 2014 at 5:38pm Community Member, 79 Posts

Hello Vix

It looks like the visibility of the htmleditor textarea is hidden.

visibility:hidden;

I have to look at the code, to see what is wrong. you can skype me thomas.paulson28

Avatar
Stefdv

12 February 2014 at 9:50am Community Member, 110 Posts

Hi there,

any progress on this? I searched everywhere but cannot find a post that fully describes how i can add a htmleditor field in the frontend...
I'm using SS3.1

As far as i understand the simpleHtmleditorfield from dataobjectmanager is no longer working in ss3 ?

Go to Top