I need help getting CKEditor to read into it the existing text that I have when the user selects the text field and be able to save it back to the database. I have CKeditor in my master page and when I run the program luckily ckeditor does show up but the text is missing from the page. Another question can I use spans for the text like in my page markup below:
Page mark up to get the text that is retrieved in a sql database:
Here is the master markup that has CKeditor:
Here is the function:
Page mark up to get the text that is retrieved in a sql database:
<div class="view_form">
<h3 class="padded"><span id="splash_title" class="editable markup"><%= GetGuiString("splash_title")%></span></h3><br />
<span id="splash_text" class="editable markup"><%= GetGuiString("splash_text")%></span><br /><br />
<span id="splash_text2" class="editable markup"><%= GetGuiString("splash_text2")%></span><br /><br />
<span id="splash_text3" class="editable markup"><%= GetGuiString("splash_text3")%></span><br /><br />
<br /><br />
</div>Here is the master markup that has CKeditor:
<%--The markup version of the dialog form.--%> <div id="dialog-markup" title="Edit Formated Text"> <p>Use this editor below to add formated text, the toolbar at the top<br />of the editor contains many useful functions.</p> <label id="lbl_Markup" for="txt_Markup">Formated Text: </label><br /> <CKEditor:CKEditorControl ID="txt_Markup" CssClass="data gui_text" runat="server" Toolbar="Source|Bold|Italic|Underline|Strike|-|Subscript|Superscript Cut|Copy|Paste|PasteText|PasteFromWord Undo|Redo|-|Find|Replace|-|RemoveFormat NumberedList|BulletedList|-|Outdent|Indent|Table / JustifyLeft|JustifyCenter|JustifyRight|JustifyBlock Styles|Format|Font|FontSize|TextColor|BGColor"> </CKEditor:CKEditorControl> <label id="lbl_MarkupEffDate" for="txt_MarkupEffDate">Effective Date: </label> <input id="txt_MarkupEffDate" type="text" name="Eff_Date" class="dateField data gui_date_eff" /><br /> <label id="lbl_MarkupTrmDate" for="txt_MarkupTrmDate">Term Date: </label> <input id="txt_MarkupTrmDate" type="text" name="Trm_Date" class="dateField data gui_date_trm"/><br /> </div>
Here is the function:
$(function ()
{
// $( "#dialog-markup" ).dialog("destroy");
$("#dialog-markup").dialog(
{
//CKEDITOR:instances['gui_key'].setData(html);
//var textData = CKEDITOR.instances['gui_key'].setData(html);
autoOpen: false,
height: 600,
width: 800, //600,
modal: true,
buttons:
{
"Save": function () {
var GuiText = $(".gui_text").text();
if (GuiText == "")
GuiText == " ";
editableControl[0].innerHTML = GuiText;
var guiKey = "";
if ($(editableControl).attr('gui_key') != null)
guiKey = $(editableControl).attr('gui_key');
else
guiKey = $(editableControl).attr('id');
var MarkupGui = new Object();
MarkupGui.key = guiKey;
MarkupGui.levels = $('input[id$="hidden_Levels"]').val();
MarkupGui.effectiveDate = $('.gui_date_eff').val();
MarkupGui.terminationDate = $('.gui_date_trm').val();
MarkupGui.textValue = $('.gui_text').val();
//MarkupGui.hidden = hidFlag
var DTO = { 'mg': MarkupGui };
$.ajax({
type: "POST",
url: "GuiConfigWS.asmx/SaveSimpleToDB",
contentType: "application/json; charset=utf-8",
dataType: "json",
data: JSON.stringify(DTO),
success: AjaxSuccess,
error: AjaxFailure
}); //end of ajax call
$(this).dialog("close");
return false;
},
//ProcessGui("markup"),
"Cancel": function ()
{
$(this).dialog("close");
} //End of Cancel button
} //end of buttons
}); //end of dialog
});
Re: Help with CKeditor getting existing text and saving to d