[CLOSED] Strange symptoms in textarea in different browsers.

  1. #1

    [CLOSED] Strange symptoms in textarea in different browsers.

    Strange symptoms in textarea in different browsers.
    I define the MaxLength property to 250.
    In IE the textarea allow I type more than 250 chars. If i stop typing the textarea truncate the excess chars.

    In Chrome don't allow I type more than 250 chars, and stop when 250 chars limit is reached

    Tested on:
    IE8 and IE9
    Chrome: 14.0.803.0

    Last svn update: 06/27/2011

    Chrome
    Click image for larger version. 

Name:	MaxLengthChrome.png 
Views:	82 
Size:	27.3 KB 
ID:	2954

    IE9
    Click image for larger version. 

Name:	MaxLengthIE.png 
Views:	89 
Size:	52.7 KB 
ID:	2955

    <body>
        <form id="form1" runat="server">
        <ext:ResourceManager runat="server">
        </ext:ResourceManager>
        <div>
            <ext:TextArea runat="server" MaxLength="250" FieldLabel="Max Length 250"
                Width="450" Height="300">
            </ext:TextArea>
        </div>
        </form>
    </body>
    Last edited by Daniil; Jul 11, 2011 at 9:33 AM. Reason: [CLOSED]
  2. #2
    Hi,

    The following thread is related, see

    http://forums.ext.net/showthread.php?4163#post17842

    Summary: There is no native browser based way to truncate text in a TextArea field, so the problem worked-around by cropping the text at intervals.

    I think the issue might be the frequency at which the Invalid Listener is fired in IE.
    Geoffrey McGill
    Founder
  3. #3
    Hi Geoffrey,

    I don't know if is the best solution, but works fine for me and don't allow user continue typing.

    design code:
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TextArea._Default" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Untitled Page</title>
    
        <script language="javascript" type="text/javascript" src="default.js"></script>
    
    </head>
    <body>
        <form id="form1" runat="server">
        <ext:ResourceManager runat="server">
            <Listeners>
                <DocumentReady Handler="HandlerMaxLength();" />
            </Listeners>
        </ext:ResourceManager>
        <div>
            <ext:TextArea runat="server" ID="txtMaxLength" MaxLength="250" FieldLabel="Max Length 250"
                Width="450" Height="300">
            </ext:TextArea>
        </div>
        </form>
    </body>
    </html>
    javascript file:
    var HandlerMaxLength = function () 
    {   
            var func = function() 
            {         
                var len = parseInt(this.getAttribute("maxlength"), 10);
                if(this.value.length > len) 
                {
                    this.value = this.value.substr(0, len);
                    return false;
                }
            }
    
        var txts = document.getElementById('txtMaxLength'); 
    
        txts.onkeyup = func;
        txts.onblur = func;
    }
    just another workaround :)

    tested in IE8/IE9
  4. #4
    Hi Marcelo,

    You can be also interested in:
    http://forums.ext.net/showthread.php?9499

Similar Threads

  1. INSERT KeyMap (all browsers)
    By David Pelaez in forum 1.x Help
    Replies: 1
    Last Post: Jan 25, 2011, 2:36 PM
  2. [CLOSED] display difference between browsers
    By Stefanaccio in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Dec 29, 2010, 6:43 AM
  3. [CLOSED] [1.0] Officially supported browsers
    By jmcantrell in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Sep 22, 2010, 12:55 PM
  4. Replies: 7
    Last Post: May 09, 2009, 8:06 AM
  5. [CLOSED] Hidden tab in IE7, but visible in other browsers
    By juanpablo.belli@huddle.com.ar in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Mar 18, 2009, 1:32 PM

Tags for this Thread

Posting Permissions