Back Button

5 posts, 0 answers
  1. Darren
    Darren avatar
    3 posts
    Member since:
    Oct 2007

    Posted 03 Nov 2007 Link to this post

    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!
  2. Lini
    Admin
    Lini avatar
    2146 posts

    Posted 05 Nov 2007 Link to this post

    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
  3. Darren
    Darren avatar
    3 posts
    Member since:
    Oct 2007

    Posted 06 Nov 2007 Link to this post

    Thanks Lini, know any good spots for info on how to do that?

    Thanks!
  4. Lini
    Admin
    Lini avatar
    2146 posts

    Posted 07 Nov 2007 Link to this post

    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
  5. Darren
    Darren avatar
    3 posts
    Member since:
    Oct 2007

    Posted 27 Nov 2007 Link to this post

    Thanks Lini!
Back to Top