keystrokes not recorded in textarea in preview mode

6 posts, 0 answers
  1. Ronnie Robertson
    Ronnie  Robertson avatar
    5 posts
    Member since:
    Dec 2009

    Posted 15 Dec 2009 Link to this post

    Hi, I am using the radeditor to allow users to create their own templates for responding to radiology studies.  I allow the user to create templates by putting the control in design mode.  Only textboxes and textareas are allowed in the template.  I allow the user to fill in the form fields on the template by putting the control in preview mode.  This all works very well except for one problem.  I am having a problem with the textarea form element.  I am unable to type into the textarea form element in preview mode in IE only (tried version 7 and 8) - it works fine in Firefox and Safari.  When I click in the textarea, I get a blinking cursor - but when the first key is hit, the textarea loses focus and the keystroke is not recorded.  Is this a known bug?  I have version 209.2.826.20. 

    Thanks,

    Ronnie Robertson
  2. Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 16 Dec 2009 Link to this post

    Hi Ronnie,

    The purpose of Preview mode is to preview the content only and the content editing is disabled by default. Yes, you can type in the TextArea elements in this mode in Firefox, but the content is not saved inside the <textarea></textarea> tags when typing in this mode and when you switch to HTML mode it will be deleted.

    The only way to fill the textarea elements is in Design mode, where the content editing is enabled.


    Kind regards,
    Rumen
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ronnie Robertson
    Ronnie  Robertson avatar
    5 posts
    Member since:
    Dec 2009

    Posted 16 Dec 2009 Link to this post

    Hi Rumen,

    Thanks for the response.  Since I have hidden the toolbar that allows the user to change the mode of the control - I have explicit control of the mode the control is in (always design for designing templates and preview for filling them out - never html mode).  The keystrokes seem to be preserved between the textarea tags in preview mode and are available on a postback in firefox and safari - just can't enter keystrokes in IE.  Is there any way to enable content editing in preview mode as this may allow the control to function as desired?

    thanks in advance,

    Ronnie Robertson

  5. Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 18 Dec 2009 Link to this post

    Hi Ronnie,

    As I already wrote the content editing in Preview mode is disabled on purpose and it is not possible to type in the textboxes. Nevertheless, the code below demonstrates how to achieve your scenario by making the Preview mode iframe editable, but disabling the onkeydown event outside of the textarea elements:

    <telerik:RadEditor ID="RadEditor1" OnClientModeChange="OnClientModeChange" runat="server">
        <Content><textarea></textarea></Content>
    </telerik:RadEditor>
    <script type="text/javascript">
    function OnClientModeChange(editor, args)
    {
           if ($telerik.isIE)
           {   
               var mode = editor.get_mode();                    
               switch (mode)
               {
                  case 4:
                  editor.set_editable(true);
                  setTimeout(function()
                  {
                      editor.get_contentArea().attachEvent("onkeydown", StopTypingOutsideTextArea);
                      function StopTypingOutsideTextArea()
                      {
                          if (editor.getSelectedElement().tagName != "TEXTAREA")
                          {
                              return false;
                          }
                           
                      }
                  }, 100);
                  break;
              }
         }
    }
    </script>


    Greetings,
    Rumen
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  6. Biron Groupe Santé
    Biron Groupe Santé avatar
    1 posts
    Member since:
    Apr 2011

    Posted 07 Apr 2014 in reply to Rumen Link to this post

    hi, very usefull trick.  thank you.
    however, the enter key don't work in IE 10.  Is there's a way to be able to change line with the enter key in a textarea in previewmode ? is not, any other workaround to achieve the same result ?
    thanks,
    Andre
  7. Ianko
    Admin
    Ianko avatar
    1535 posts

    Posted 09 Apr 2014 Link to this post

    Hi  Biron,

    The provided approach is not a supported one and any further results from this code should be handler per case.

    As mentioned by Rumen, the Preview mode is not designed as editable area and there is no proper and easy solution to change this properly. For any editing purposes, the user should use the Design mode.

    Regards,
    Ianko
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017