Textarea in embedded form

Hi,

I would like to use a WYSIWYG editor inside an embedded camunda form.
I load CKEDITOR and in order for the script to initialize the editor I need a text area with a closing tag, that is something like the following:
<textarea name="myField" id="editor" cam-variable-name="myField" cam-variable-type="String"></textarea>
When I use such a field in the page, the editor is initialized normally but the attribute is not submitted on form submit. I read in the forum that when using a textarea I should be using a self closing tag, that is something like the following:
<textarea name="myField" id="editor" cam-variable-name="myField" cam-variable-type="String"/>
In this case though, CKEDITOR refuses to initialize :slight_smile:

Do you have any suggested solution or example to this problem?

Thank you

Hi again,
I managed to find a workaround to this problem, that is to dynamically use js for creating a custom variable on submit. I am pasting the sample code below:

camForm.on('submit', function(evt) {
      var fieldValue = $('.ck-content').html();
	  var variableManager = camForm.variableManager;
      variableManager.createVariable({
       		 name: 'userComments',
       		 type: 'String',
        	 value: fieldValue,
       		 isDirty: true
      });

   });

But now I have stumbled upon another problem.The problem I am facing is the following:
I have a series of user tasks and in each task I need to show 2 areas in an embedded form. One for adding comments (that is where CKEDITOR mentioned above comes into play) and one for showing previous comments (added in previous tasks by other users).
For doing so I need to be able to store a large String with all the previous comments in some process variable to be able to show it. There is a limitation to 4000 chars though so I cannot do that.
To overcome this problem, I store a StringBuffer as the process variable (by using an end listener in each task)
I do not know how I can display this information in the UI though. If I try (through a start listener) to create a String process variable then this is also stored in the database. If I make it transient, then this is not available in the task’s embedded form.

Do you have any suggestions/example for this?

Thank you

Hi @Jagg,

please have a look into this example about Json variables in embedded task forms: camunda-bpm-examples/usertask/task-form-embedded-json-variables at master · camunda/camunda-bpm-examples · GitHub

Hope this helps, Ingo

Hi @Ingo_Richtsmeier

Thank you for the example. This was very helpful indeed. Unfortunately the problem is not solved though. I manage to pass the information back to the server inside a JSON object but the information cannot be persisted to the database. I get the attached error. As you will notice I try to save an attribute which is large.

error.txt (45.8 KB)
Do you have any suggestions?

Thank you