Send to the DB


#1

Hello,

I’m developing an activity where the user will have the option of having a space to write their code and then submit it to the database.

The problem is that I’m not getting a way to get the code written to the editor and send the text to the DB.

Could someone give me a hand? I’m using version 5.16 because it was the easiest to apply to the site.

*** If anyone knows of any tutorial on how to use the recent version, please send me.


#2

It all depends on your stack… But the easiest is certainly to do like it says on the manual page:

var myCodeMirror = CodeMirror.fromTextArea(myTextArea);

This will change a textarea to a codemirror instance, and the textarea’s value will be updated to the codemirror value for you so when the user submit the form, it will send it just like any other textarea.