Jump to content

TinyMCE save on database


araujoadanr

Recommended Posts

Hello, thanks for answering.

In my production project I use SDAC,

But not everyone uses this component, that's why I prepare the test case with ClientDataset, but I can prepare with another data access component, which seems more appropriate.


1- Button 1 creates the dataset in memory

2- Buttons 2, try to add the text using two methods that I found in the forum.

 

image.png.a416126b95e4e3c598ce1ad2a1599654.png

 

Link to comment
Share on other sites

OK.

  CDSText.Append;
  UniSession.AddJS('ajaxRequest(MainForm.form, "mce", ["text="+tinyMCE.get("ed1").getContent()])');
  CDSTextMemo.Value := HTMLmce;
  CDSText.Post;

 

When you initialize TinyMCE, you should use the TinyMCE events, such as "change", to send the modified data to the server.

Link to comment
Share on other sites

13 hours ago, adan200 said:

Do you have an example? I don't know much about client side events.

Hello,

You are using version 3, try this:

1. 

<textarea id="ed1" style="width: 100%; height: 400px;"></textarea>
<script>
tinyMCE.init({
   theme : "advanced",
   plugins : "autolink,lists,spellchecker,pagebreak,style,layer,table,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",

   // Theme options
   theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
   theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
   theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
   theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
   theme_advanced_toolbar_location : "top",
   theme_advanced_toolbar_align : "left",
   theme_advanced_statusbar_location : "bottom",
   theme_advanced_resizing : true,

   extended_valid_elements : "img[class=myclass|!src|border:0|alt|title|width|height]",
   mode: "exact",
   elements : "ed1",
   onchange_callback : function() {ajaxRequest(MainForm.form, "mce", ["text="+tinyMCE.get("ed1").getContent()])}
});
</script>

...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...