shows only html code when pushing back button

Looking for help? Ready to help? That's the place to go.

shows only html code when pushing back button

Postby andogro » Mon Oct 13, 2008 10:31 pm

I am using fckeditor with asp.net. When I make an update to a page, it displays fine and it saves fine. However, if I push the button to go back to the editor, the text no longer shows itself in wysiwyg mode, but instead is wrapped in html code. If I view the source, it renders all of those extra characters as well. I have to exit the page and get back in for it to show up normally. If I save while in the html code mode, it saves <h1>header</h1><p>stuff here</p> etc to the page. Is there a setting to auto refresh so that it renders correctly when I go back to the editor?

Thanks,
Andy
andogro
 
Posts: 1
Joined: Mon Oct 13, 2008 10:25 pm

Re: shows only html code when pushing back button

Postby aaronmorlocks » Sat Oct 18, 2008 11:14 pm

Yes... this happen to me too...

Please somebody help :!:
aaronmorlocks
 
Posts: 2
Joined: Sat Oct 18, 2008 11:13 pm

Re: shows only html code when pushing back button

Postby himinomaha » Sun Oct 19, 2008 2:48 am

I too am having this problem. I've tried reloading the page via javascript and it didn't help. Only manually hitting the refresh button seems to correct the text. The site I'm working on requires one to be able to go back and forth between pages and edit the contents of the FCKedit control.

Please help
himinomaha
 
Posts: 2
Joined: Sun Oct 19, 2008 2:40 am

Re: shows only html code when pushing back button

Postby himinomaha » Sun Oct 19, 2008 8:40 am

I finally found something that worked for me. This is in ASP.NET.

In the Page_Load of the page I was going back to I added the following

Response.Cache.SetCacheability(HttpCacheability.NoCache)

The website I found this on was http://www.xtremevbtalk.com/showthread.php?t=296478

Hope this helps
himinomaha
 
Posts: 2
Joined: Sun Oct 19, 2008 2:40 am

Re: shows only html code when pushing back button

Postby aaronmorlocks » Mon Oct 20, 2008 1:09 am

himinomaha wrote:I finally found something that worked for me. This is in ASP.NET.

In the Page_Load of the page I was going back to I added the following

Response.Cache.SetCacheability(HttpCacheability.NoCache)

The website I found this on was http://www.xtremevbtalk.com/showthread.php?t=296478

Hope this helps


Thanks for the reply. I try to do this way but...

For me it doesn't work because the request is to the same page. I'm using a multiview and in the first postback I show the fckeditor, in the next I show another content (a message for confirmation for example). When I use NoCache, nothing even the other field values are keep.

I'm still lookin' for a solution... :cry:
aaronmorlocks
 
Posts: 2
Joined: Sat Oct 18, 2008 11:13 pm

Re: shows only html code when pushing back button

Postby ceyeber62 » Thu Nov 20, 2008 2:25 pm

Having the same problem here with a customer site: entering text, storing it to the database is no problem. However, going back by using the Back button reveals the HTML tags around the text; users who inadvertently store the data again results in storing the tags to the database. This is highly undesirable.

The proposed solution does not work for us, however, due to the fact that we must be using the Back/Forward buttons and cannot interfere with the cache. Is there any alternative solution available?

Any help highly appreciated.

Cheers!
ceyeber62
 
Posts: 1
Joined: Thu Nov 20, 2008 2:11 pm

Re: shows only html code when pushing back button

Postby Han de Monnink » Tue Nov 25, 2008 1:39 pm

I ran into this same problem; hitting the backbutton in the browser causes the fckeditor to display the HTML code.

After debugging the code I've comeup with following solution; when the backbutton is press the information is not refetched but it is comming from the cache, which seems to store it in a HTMLEncoded form, so when the window loads we will have to HTMLDecode the message before display it, since HTMLDecoding will not do anything to normal texts ( initial created text in the editor) we can just apply it to all content.

solution :
Add following code to file: FCKEditor\editor\fckeditor.html


window.onload = function()
{
// 25-11-2008 Han: Fixing the issue with the backbutton, when the back/forward button is hit then the html to display is
// still HTMLEncoded which will cause the control to display html control sequences in the editor.
// The easiest solution is probably to always htmldecode the value before it is beaing displayed in the editor, this can be done
// using the statement below.
// FCK.LinkedField.value=FCKTools.HTMLDecode(FCK.LinkedField.value);

FCK.LinkedField.value=FCKTools.HTMLDecode(FCK.LinkedField.value);

InitializeAPI() ; // existing code line
.......


after adding the code line you will have to make sure that the javascript is downloaded to the client, so in your browser delete the local files ( tools->internet options->delete files).

And then it should all work as expected, good luck

Han
Han de Monnink
 
Posts: 1
Joined: Tue Nov 25, 2008 1:13 pm

Re: shows only html code when pushing back button

Postby takis » Sun Nov 30, 2008 9:16 pm

When the user hits the back button - and caching is enabled - the browser will restore the latest contents of the textarea that the FCK is associated with. So, before the page was unloaded one should make sure that this textarea is properly updated with the latest contents of the editor. This way, perhaps the editor will regain whatever it had before, when the back button is hit. However, when the page is being unloaded the DOM is not in a position of being correctly manipulated (I am not sure exactly what this means, but it is generally correct). So, the textarea will not be able to be updated correclty with the latest contents of the editor. To sum up one must find a way to update it before the unload event of the page!

I tried simply doing this via the window unload event but it doesn't work.

Another solution would be by sending the contents of the FCK to the server and storing it somewhere so as to restore it later on. But this would only work if the user hits a submit button or something. If the user simply leaves the page then this cannot work...
takis
 
Posts: 12
Joined: Sat Nov 29, 2008 2:39 am

Re: shows only html code when pushing back button

Postby wdc77 » Thu Jun 11, 2009 8:41 am

FCK.LinkedField.value=FCKTools.HTMLDecode(FCK.LinkedField.value);


Brilliant! Worked a treat. Thanks Han.
wdc77
 
Posts: 1
Joined: Thu Jun 11, 2009 8:39 am


Return to Support

Who is online

Users browsing this forum: MSN [Bot], Yahoo [Bot] and 1 guest