I'm using the GetXHTML(true) javascript API method to get the current value of my editor field and compare it against the original value that was sent to the editor in order to check for changes. If changes were made, I'd ask the user to confirm they want to leave. I'd think this would yield good results, but unfortunately GetXHTML formats certain aspects of tags differently, for example the posted code:
<img src="test.jpg" class="test">
gives the following via GetXHTML:
<img class="text" src="test.jpg">
Is there anyway to intercept the code that will be posted through the javascript API, or is this something that will require traversing the multitude of browser methods to work with iframe form values? Does anyone have any idea why the two might be different?
Thanks!
Jason
<img src="test.jpg" class="test">
gives the following via GetXHTML:
<img class="text" src="test.jpg">
Is there anyway to intercept the code that will be posted through the javascript API, or is this something that will require traversing the multitude of browser methods to work with iframe form values? Does anyone have any idea why the two might be different?
Thanks!
Jason
RE: GetXHTML returns different data than POST
Your problem is that the HTML that it is provided to the editor can be changed automatically just by the parsing done by the browser and the formatting of FCKeditor so your check can mark the content as changed although the user didn't press any key.
I think that the best way to do check if the content has changed is to use the API call IsDirty() because it's just one call, you don't have to care about how it is done and if there are bugs in it they can be fixed in future versions.