Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
560
How to detect HTML has changed
posted

I have a WebHtmlControl on a page and some existing code to check if the text of the control has changed. This is done by simply storing the original value when the form loads and comparing it to the current value using the KeyDown and AfterAction client side events.

I have recently enabled the HTML Editor feature and included more toolbar options and now have an issue where changing the styling, ie: highlighting text and changing the text colour, is not detected. This is because the text hasn't changed, just the markup.

I have implemented a similar piece of code that stores the value in document.getElementById("txtEmailHTMLBody_tw").innerHTML when loaded and compares this using the same actions defined above.

The problem i have is that the comparison does not evaluate as expected as it appears the styling/markup has not yet changed, ie: the AfterAction fires before modifying the innerHTML property.

Is there another way of doing this? It has to be client side and i'm using version 11.1.20111.2135.

Thanks in advance.

Parents
  • 49378
    posted

    Hi Warwick IC Sytemst Ltd,

    Thank you for posting in the community.

    Note that the current html markup in the editor may be accessed on the client by using something similar to:

    iged_getById("WebHtmlEditor1").getText();

    As you have noted, the markup in the HTMLEditor is not changed in time on AfterAction. I can therefore suggest that you use the setTimeout javascript function in order to check for a change in the markup and execute some logic if needed. For instance:

    function WebHtmlEditor1_AfterAction(oEditor, actID, oEvent, p4, p5, p6, p7, p8, act){
        //log the markup in the editor in the browser console in 10 ms.
        setTimeout("console.log(iged_getById('WebHtmlEditor1').getText());",10);
    }

    Hope this helps.

     

Reply Children