Storing c1Editor text in hidden field in javascript

Originally Posted 27 March 2015, 5:47 am EST

  • Originally Posted 27 March 2015, 5:47 am EST

    Hi there,

    I have a C1Editor control on my page and several hidden fields. The hidden fields are populated from records in a database in the code behind. The page also has a c1menu, when the user clicks an item on the menu the text from the relevant hidden field is loaded into the c1editor and all is good. I now want to capture changes the user makes and save them back into the hidden field. I'd like to use the textchanged event but I just cannot figure out how to get this in javascript/jquery.


    <wijmo:C1Editor runat="server" ID="Editor" ShowFooter="False" ShowPathSelector="False" Mode="Simple"
    SimpleModeCommands="Undo,Redo,FontName,FontSize,ForeColor,Bold,Italic,UnderLine,NumberedList,BulletedList,Link,Spelling">
    </wijmo:C1Editor>


    I've tried the following but it just breaks the formatting of the editor.
      $(document).ready(function () {

    $("#Editor").wijeditor({
    TextChanged: function (e, cmd) {

    }
    });


    });


    Do you have any examples of how to use TextChanged event in jquery for C1Editor.

    Thanks.
  • Reply

    Hi,

    The correct way of accessing the client side api of server side control is to use 'c1editor' method instead of 'wijeditor'. Similarly, you can access client side api of C1GridView by using 'c1gridview' method.

    Here is the code snippet code for better understanding:


    $("#C1Editor1").c1editor({
    textChanged: function (e, data) {
    $("#HiddenField1").val($("#C1Editor1").c1editor("getText"));
    }
    })


    For complete implementation, please refer to the attached sample application.

    Thanks,
    Raunak Ladha
    2015/03/C1EditorTextChangedEvent.zip
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels