This is a migrated thread and some comments may be shown as answers.

[Solved] Do you want to save changes?

2 Answers 131 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Adrian
Top achievements
Rank 1
Adrian asked on 25 Apr 2008, 01:43 PM
I need to prompt the user if they would like to save changes when they navigate off the page without clicking save. Is there a js property on radeditor that returns if a change has been made in the content since the content was set serverside on first load? An example would be useful, thanks Adrian

2 Answers, 1 is accepted

Sort by
0
Adrian
Top achievements
Rank 1
answered on 28 Apr 2008, 01:32 PM
I have an answer to the first question but there is still a problem?

rtText = $telerik.radControls[2].get_initialContent()
rtNew = $telerik.radControls[2].get_html();

OR

rtText = editor.get_initialContent();
rtNew = editor.get_html();

The problems are:
<br> <br />'s are inconsistent between the 2
White space on one but not the other (which I can't strip out!)
 Line spaces on one but not the other.

I need to do a simple string comparison to see if the user has made a change.

Any suggestions?

Adrian
0
Lini
Telerik team
answered on 28 Apr 2008, 03:22 PM
Hello Adrian,

Use .get_html(true) instead of just .get_html(). The "true" parameter will make the editor run its content filters, which are also run when the content is submitted. This way you will be able to compare the initial content with the current one and tell if there are any differences.

Kind regards,
Lini
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Editor
Asked by
Adrian
Top achievements
Rank 1
Answers by
Adrian
Top achievements
Rank 1
Lini
Telerik team
Share this question
or