1. #1
    Sencha User
    Join Date
    Jun 2010
    Location
    Bangalore, India
    Posts
    13
    Vote Rating
    0
    nitinfuture is on a distinguished road

      0  

    Default How to restrict a user to type only certain characters in the text field

    How to restrict a user to type only certain characters in the text field


    Hi,
    I need a text field where a user can type only certain characters like number field does where user can enter only numbers and dot.
    I tried with setting the regex for the text field but it allows user to type other characters and on blur it shows validation message. But I don't even want to allow the user to put other characters in it.
    Is there any way to get this?

    Any help will be appreciated.

    -Nitin

  2. #2
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    Take a look at the numberfield sources how it is archieved there.

    Basicly it listens for the keypress event, checks the key and if it is a not allowed one, you have to prevent the default action.

  3. #3
    Sencha User
    Join Date
    Jul 2012
    Posts
    4
    Vote Rating
    0
    Sarika is on a distinguished road

      0  

    Default


    My requirement is , the text field should only accpet the numbers..
    any help is apreciated

  4. #4
    Sencha User
    Join Date
    Nov 2011
    Location
    China
    Posts
    14
    Vote Rating
    0
    shingocat is on a distinguished road

      0  

    Default NumericField

    NumericField


    If you only want to receive number value, why not using NumericField.

    Only maybe you add a Listener to your TextField, and do some logic code to meet your requriements!

Similar Threads

  1. Text field to accept Kanji characters?
    By Rodkun in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 17 Feb 2009, 7:18 PM
  2. Replies: 2
    Last Post: 20 Jan 2009, 8:44 PM
  3. How to restrict textarea maxLength characters...
    By ajax&me in forum Ext 2.x: Help & Discussion
    Replies: 5
    Last Post: 29 May 2008, 9:30 AM
  4. html editor for text field with more characters
    By c_ankit in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 12 Jan 2008, 9:30 AM

Thread Participants: 3

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi