[CLOSED] Preventing user input

  1. #1

    [CLOSED] Preventing user input

    Hi guys,

    How can you prevent the user from entering text in a textbox. Can I do so using the javascript code below


     ValidatePasswordLength: function (el) {
            var value = el.getValue();
    
            if (value.length == 128) {
                el.handled = true;
            }
        } // End ValidateUsernameLength
                            <ext:TextField 
                                ID="Username" 
                                runat="server"
                                FieldLabel= "<%# Html.LabelFor(m => m.Username) %>"
                                AllowBlank="false"
                                AnchorHorizontal="100%"
                                Text = '<%# Model.Username %>'
                                AutoFocus= "true" 
                                AutoFocusDelay="100"
                                MinLength= "1"
                                MaxLength= "50"
                                EnableKeyEvents="true"
                                AutoDataBind="true">
                                <Listeners>
                                    <KeyPress Fn ="doSomething" />
                                </Listeners>
                             </ext:TextField>
    Last edited by Daniil; Mar 07, 2011 at 1:39 PM. Reason: [CLOSED]
  2. #2
    Hi,

    I would suggest you to use .MaxLength.

    Example
    <ext:TextField runat="server" MaxLength="4" />
  3. #3

    Thanks

    Thanks a lot that worked.

Similar Threads

  1. Replies: 1
    Last Post: Apr 24, 2012, 3:38 AM
  2. [CLOSED] Preventing grid rows from expanding
    By peter.campbell in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jan 26, 2012, 1:36 PM
  3. [CLOSED] SpinnerField lose user input in groupingview of gridpanel
    By leon_tang in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jul 22, 2011, 3:37 PM
  4. Distinguish user input from code change
    By syncos in forum 1.x Help
    Replies: 1
    Last Post: Mar 08, 2011, 7:30 AM
  5. [CLOSED] Trouble with user input in
    By smart+ in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Oct 31, 2010, 8:22 PM

Posting Permissions