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

keystrokes not recorded in textarea in preview mode

5 Answers 84 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Ronnie Robertson
Top achievements
Rank 1
Ronnie Robertson asked on 16 Dec 2009, 12:07 AM
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

5 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 16 Dec 2009, 09:11 AM
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.
0
Ronnie Robertson
Top achievements
Rank 1
answered on 16 Dec 2009, 03:07 PM
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

0
Rumen
Telerik team
answered on 18 Dec 2009, 10:33 AM
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.
0
Biron Groupe Santé
Top achievements
Rank 1
answered on 07 Apr 2014, 08:33 PM
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
0
Ianko
Telerik team
answered on 09 Apr 2014, 07:16 AM
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.

 
Tags
Editor
Asked by
Ronnie Robertson
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Ronnie Robertson
Top achievements
Rank 1
Biron Groupe Santé
Top achievements
Rank 1
Ianko
Telerik team
Share this question
or