On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • It looks like the Update processor is not formatting the Rich Text content properly.

    If any html tags are inserted (<strong>, <em>, etc), the following error occurs on save:

    Uncaught SyntaxError: Invalid regular expression: missing /

    This is the bit that is malformed:
    ({"success":true,"message":"","total":0,"data":[],"object":{"form_id":1,"name":"sss","enablepages":false,"active":false,"owners":"","emailrecipients":"","opendate":0,"closedate":0,"maxnumbersubmissions":0,"successmessage":"dsf<b>sdfds<\/b>","successtargetdocid":0,"successredirectenable":false,"maxreachedmessage":"","context":"All","createdon":1419825711,"createdby":1,"editedon":1419826190,"editedby":1,"action":"mgr\/forms\/update"}}</b>)


    in the successmessage parameter, it is not encoding/escaping the first <b> tag, but it is the closing tag, and that is wigging out the JSON string

    Is there something that I can add to the update.class.php to clean this up?

    This question has been answered by dvstudiosinc. See the first response.

    • discuss.answer
      Digging through things (and looking at other Extras that save RTE content), it looks like the part of both the forms/update.class.php and forms/create.class.php that is causing the error is the public function cleanup(), more pointedly the return statement "return parent::cleanup();"

      I replaced it with the following (which unsets the RTE fields prior to returning the success response... which seems to be where the issue was):
      public function cleanup() {
              $objectArray = $this->object->toArray('',true);
              unset($objectArray['successmessage'],$objectArray['maxreachedmessage']);
              return $this->success('',$objectArray);
          }
      


      This fixed the error and now the Form Manager will complete its save process without complaint.

      It sure would be nice to have this component on GitHub to put all these updates I have been implementing on my install somewhere that Charles could pull em....