Unable to set HTML field of a SugarBean

On my custom endpoint that does not require authentication I am trying to save an HTML string to a custom HTML field.

Outputting the HTML string to a TextArea field shows that it is definitely working and the string is correct.

In the screenshot below I have concatenated two versions of the HTML string - one with utf8_decode();  and the other (after the "\n\n----------\n\n", I thought TextArea would add newlines, ignore that please) as the plain string as I was checking whether it was received as Unicode.

I am trying to set the value of the HTML field in the same way as the TextArea, but it is not working. How am I supposed to do it?

Parents
  • According to the documentation

    http://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_6.5/Module_Framework/Metadata/SugarField… 

    and code in <mysugar>/clients/base/fields/html/html.js the html field type is read only.

     

     /**
         * @inheritdoc
         *
         * The html area is always a readonly field.
         * (see htmleditable for an editable html field)
         */

        initialize: function(options) {
            options.def.readonly = true;
            this._super('initialize', [options]);
        },

    HTH

    FrancescaS

  • I managed to create a TinyMCE field, but I am getting some errors in Chrome JS console when trying to edit it, so I cannot actually change the value as a user

    <?php

    // File custom/Extension/modules/Case_Replies/Ext/Vardefs/sugarfield_message_c.php

    $dictionary['Case_Replies']['fields']['message_c'] = array(
        'labelValue' => 'Message',
        'type' => 'htmleditable_tinymce',
        'dismiss_label' => true,
        'span' => 12,
        'tinyConfig' => array( // Location of TinyMCE script
            'script_url' => $sugar_config['site_url'] . '/include/javascript/tiny_mce/tiny_mce.js',
            'height' => '100%',
            'width' => '100%',
            // General options
            'theme' => 'advanced',
            'skin' => 'sugar7',
            'plugins' => 'style,paste,inlinepopups',
            'entity_encoding' => 'raw',
            'forced_root_block' => false,
            // Theme options
            'theme_advanced_buttons1' => "code,separator,bold,italic,underline,strikethrough,separator,bullist,numlist,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,forecolor,backcolor,separator,fontsizeselect",
            'theme_advanced_toolbar_location' => "top",
            'theme_advanced_toolbar_align' => "left",
            'theme_advanced_statusbar_location' => "none",
            'theme_advanced_resizing' => false,
            'schema' => 'html5',
            'template_external_list_url'  => 'lists/template_list.js',
            'external_link_list_url' => 'lists/link_list.js',
            'external_image_list_url' => 'lists/image_list.js',
            'media_external_list_url' => 'lists/media_list.js',
            'theme_advanced_path' => false,
            'theme_advanced_source_editor_width' => 500,
            'theme_advanced_source_editor_height' => 400,
            'inlinepopups_skin' => 'sugar7modal',
            // Url options for links
            'relative_urls' => false,
            'remove_script_host' => false,
        ),
        'full_text_search' => array(
            'enabled' => true,
            'boost' => '1',
            'searchable' => true,
        ),
    );
  • Hi Artis Plocins 

    The module KBContents has a tinymce field, it works great on creating a record. As you can see it defines it own Htmleditable_tinymceField, so probably you will need to do something like that.

    Kind regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
Reply Children
No Data