We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 54928
    • 3 Posts
    Hi, community!
    I created a copy of the field "content" ("content2")

    it is shown in the admin panel when I create a resource.

    But only the text is saved correctly.
    If any html tags are used, the save process hangs. (but everything is saved in the database)

    Error I get in console (paste in field /assets/images/f2f2a.jpg)
    GET https://site.com/%22//assets//images//f2f2a.jpg/%22 404- 
    
    VM4398:1 Uncaught SyntaxError: Invalid or unexpected token at doDecode (ext-all.js:21) at Object.decode (ext-all.js:21) at Ext.form.Action.Submit.handleResponse (utilities.js:308) at Ext.form.Action.Submit.processResponse (ext-all.js:21) at Ext.form.Action.Submit.success (ext-all.js:21) at o (ext-all.js:21) at Ext.data.Connection.s (ext-all.js:21) at HTMLIFrameElement.I (ext-all.js:21) 
    
    {"success":true,"message":"","total":0,"data":[],"object":{"id":1,"type":"document","contentType":"text\/html","alias":"index","alias_visible":true,"published":true,"pub_date":0,"unpub_date":0,"parent":0,"isfolder":false,"richtext":true,"template":1,"menuindex":0,"searchable":true,"cacheable":true,"createdby":1,"createdon":"2018-12-29 13:37:20","editedby":1,"editedon":"2019-03-02 20:14:36","deleted":false,"deletedon":0,"deletedby":0,"publishedon":0,"publishedby":0,"donthit":false,"privateweb":false,"privatemgr":false,"content_dispo":0,"hidemenu":false,"class_key":"modDocument","context_key":"web","content_type":1,"uri":"index.html","uri_override":0,"hide_children_in_tree":0,"show_in_tree":1,"content2":"\u041f\u043b\u0430\u0442\u043d\u043e\u0435 \u0432\u0438\u0434\u0435\u043e\r\n<img src=\"\/assets\/images\/f2f2a.jpg\">","create-resource-token":"5c7ab9eca22c59.00272120","reloaded":"0","parent-original":"0","parent-cmb":"","syncsite":1,"action":"resource\/update","resource_groups":"[{\"id\":4,\"name\":\"autors\",\"access\":false,\"menu\":null},{\"id\":1,\"name\":\"Office\",\"access\":false,\"menu\":null}]","preview_url":"https:\/\/site.com\/"}}



    code I use

    plugin
    switch ($modx->event->name) {
    	case 'OnMODXInit':
            $modx->map['modResource']['fields']['content2'] = NULL;
            $modx->map['modResource']['fieldMeta']['content2'] = array(
                   'dbtype' => 'mediumtext',
                   'phptype' => 'string',
                   'index' => 'fulltext',
                   'indexgrp' => 'content_ft_idx'
            );
    break;
    		
    case 'OnDocFormRender':
            $modx->controller->addLastJavascript($modx->getOption('assets_url') . 'components/js/mgr/field.js');
            break;


    field.js
    Ext.override(MODx.panel.Resource, {
        getParentMainLeftFields: MODx.panel.Resource.prototype.getMainLeftFields,
        //class_key
        getMainLeftFields: function (config) {
    
            var ParentMainLeftFields = this.getParentMainLeftFields.call(this, config);
            
            ParentMainLeftFields.push({
                xtype: 'textarea'
                        ,fieldLabel: 'resource_content2'
                        ,description: '<b>[[*content2]]</b><br />'
                        ,name: 'content2'
                        ,id: 'modx-resource-content2'
                        ,grow: true
                        ,anchor: '100%'
                        ,value: config.record.content2 || ''
            });
            return ParentMainLeftFields;
        }
    });


    Need Help!
      • 54928
      • 3 Posts
      Up!
        • 42562
        • 1,145 Posts
          TinymceWrapper: Complete back/frontend content solution.
          Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
          5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
          • 54928
          • 3 Posts
          Quote from: donshakespeare at Mar 15, 2019, 04:02 AM
          See https://github.com/modxcms/revolution/issues/13711

          and observe my quack fix smiley

          Thanks, I read it. I correctly understood that this will have to do with each update of the platform?