×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Sep 2011
    Posts
    27

    qml textField as numeric

    hi i wanna to make a numeric text feild wich accept only number as input data.and alphabets cant enter in that field plz let me know..i will very thankfull my code of text field is as


    Column {
    spacing: 4
    TextField {
    id: cellNoField
    maximumLength :15
    x:3
    width: 345
    placeholderText: "Cell No"

    }
    }

  2. #2
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    4,025

    Re: qml textField as numeric

    What is wrong with the solution given in your older thread: http://www.developer.nokia.com/Commu...eld-as-numeric

  3. #3
    Registered User
    Join Date
    Sep 2011
    Posts
    449

    Re: qml textField as numeric

    Did you try this -

    TextField {
    inputMethodHints: Qt.ImhDigitsOnly
    }

  4. #4
    Registered User
    Join Date
    Sep 2011
    Posts
    27

    Re: qml textField as numeric

    sir its not working
    inputMethodHints: Qt.ImhDigitsOnly
    i tried this but it take alphabets.i want that user cant alphabets.user can enter only numbers.plz let me know my textfield code is now


    Column {
    spacing: 4
    TextField {
    id: cellNoField
    x:3
    width: 345
    placeholderText: "Cell No"
    inputMethodHints: Qt.ImhDigitsOnly

    }
    }

  5. #5
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    4,025

    Re: qml textField as numeric

    Hope you are checking on a real device, as i think you can enter alphabets through computer keyboard inside the text field.So try testing the application on a device, i just did it & its working very fine.

  6. #6
    Registered User
    Join Date
    Jul 2011
    Posts
    12

    Re: qml textField as numeric

    I got it working like this:

    TextField {
    inputMethodHints: Qt.ImhDigitsOnly
    inputMask: "000"
    }

    That allows entering three digits and no alphabets. Its not perfect but best that I could figure out.

Similar Threads

  1. QML how to set textfield as numeric
    By mazeemanwar in forum Nokia N9
    Replies: 5
    Last Post: 2012-01-13, 11:42
  2. CommandListener on TextField.NUMERIC || TextField.PASSWORD
    By lekkie in forum Mobile Java General
    Replies: 3
    Last Post: 2007-07-09, 13:42
  3. Unfamiliar with Textfield.NUMERIC
    By jaceline in forum Personal Profile
    Replies: 1
    Last Post: 2006-05-18, 07:54
  4. TextField only allows numeric characters...
    By davidrenstrom in forum Mobile Java General
    Replies: 1
    Last Post: 2006-01-16, 15:47
  5. Numeric TextField max size 10digits?
    By epalite in forum Mobile Java General
    Replies: 5
    Last Post: 2005-11-10, 03:32

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×