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

Back Button

4 Answers 49 Views
WebParts for SharePoint
This is a migrated thread and some comments may be shown as answers.
Darren
Top achievements
Rank 1
Darren asked on 04 Nov 2007, 12:36 AM
Hi there,

I'm using RADEditor for my rich text controls on SharePoint Tasks.  I wrote a custom feature that checks the value of a field, and if it doesn't meet the criteria, it displays an error message and tells them to hit the Back button on their browser to make corrections to the Task.

When using RADEditor and the user puts some text into a RADEditor field, this text is gone when the user presses the back button.  If I disable the RADEditor feature and just use the default SharePoint edit fields, the text is preserved.

Is there a setting to allow RADEditor text fields to keep data on back button presses?

Thanks!

4 Answers, 1 is accepted

Sort by
0
Lini
Telerik team
answered on 05 Nov 2007, 04:43 PM
Hi Darren,

The browsers will restore the form value only when the it is coming from a normal input (textarea). Our editor uses an iframe for the content, which is why it always reverts to the original value when you press Back. I don't think that you can change this in the current version.

Perhaps it will be possible to change your validation so it happens before the page content is submitted. For example, you can attach to the form submit event and validate the content then.

Sincerely yours,
Lini
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Darren
Top achievements
Rank 1
answered on 06 Nov 2007, 09:53 PM
Thanks Lini, know any good spots for info on how to do that?

Thanks!
0
Lini
Telerik team
answered on 07 Nov 2007, 07:40 AM
Hi Darren,

Here is a sample JavaScript fragment that you can use as a base:
<script type="text/javascript">  
if (typeof(RadEditorGlobalArray)!= "undefined")  
{  
 function CheckContent()  
 {  
     //get first RadEditor  
     var editor = RadEditorGlobalArray[0];  
     var content =  editor.GetHtml(true);  
     // check content  
     if (false)  
     {  
         //content ok  
         return true;  
     }  
     else 
     {  
         //content not ok  
         alert("error message");  
         return false;  
     }  
 
 }  
 var oldPostback = WebForm_DoPostBackWithOptions;  
 WebForm_DoPostBackWithOptions = function(options)  
 {  
     if (CheckContent())  
     {  
        //call original postback function  
        oldPostback(options);  
     }  
 };  
}  
</script> 

In this case I simply override the postback function of the form. You can attach your code in other ways as well.

The CheckContent function gets the HTML content of the first RadEditor. You can perform validation on this content and then either display an error message or continue with the submit.

The whole code is executed only if a RadEditor is present on the page.

Regards,
Lini
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Darren
Top achievements
Rank 1
answered on 27 Nov 2007, 06:03 PM
Thanks Lini!
Tags
WebParts for SharePoint
Asked by
Darren
Top achievements
Rank 1
Answers by
Lini
Telerik team
Darren
Top achievements
Rank 1
Share this question
or