Want to access PlainText property at clien side in javascript function

Last post 04-30-2008, 1:00 AM by mtrvikas. 3 replies.
Sort Posts: Previous Next
  •  04-26-2008, 12:34 AM 39764

    Want to access PlainText property at clien side in javascript function

    I want  to acces CuteEditor PlainText property in javascript function but it return "undefined " value. How can i use this property in javascript function or in CuteEditor_OnCommand function.
       My requirement is that i want to check that cuteeditor value is blank or not when the theme applied on the cuteeditor. It shows link tag when the cute editor is blank and theme applied on editor so the editor value returns not blank. PlainText property returns the text without html tags.
       Please reply soon how i resolve this problem.
    Filed under: ,
  •  04-28-2008, 1:10 PM 39832 in reply to 39764

    Re: Want to access PlainText property at clien side in javascript function

    Use the following code:
     
     //Get the editor content
    var editdoc=editor1.GetDocument();
    alert(innerText(editdoc.body));
    function innerText(elm){ if(document.all) { return elm.innerText; } else { return elm.textContent; } }

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  04-29-2008, 10:19 AM 39889 in reply to 39832

    Re: Want to access PlainText property at clien side in javascript function

    Thanks sir
    My problem have solved by your code. Thank you very much.
  •  04-30-2008, 1:00 AM 39914 in reply to 39832

    Re: Want to access PlainText property at clien side in javascript function

    hello Adam or others
    Your code is working, but when we check by this function that editor is blank or not

    function checkEditorBlankValue()

    {

    var editorId = document.getElementById('<% = Editor1.ClientID%>');

    var content = editorId.GetDocument();

    var textofeditor=innerText(content.body);

    if(trim(textofeditor)=="")

    { var msg="Would you like to save this document?";

    var resultmsg=window.confirm(msg);

    if(resultmsg)

    {

    alert("You cannot save blank editor.")

     
    return false;

     

    }

    }

    }

    If this function return false (when editor is blank) then if we type any character in cute editor then

    function CuteEditor_OnChange(editor)

     not called at that time and if we give space then my validation function is called from which i call checkEditorBlankValue() function and 'Delete' key is not working for selected text.
     
    Please reply soon
View as RSS news feed in XML