Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Posts: 148
Registered: ‎01-08-2013
My Device: 9860
My Carrier: Airtel

Keybord Make only numberfield

Hi All, 

      

How to keyboard only make number field ? Please solve my problem.

 

Thanks & Regard

     Sanjit

Developer
Posts: 713
Registered: ‎05-31-2010
My Device: 8520
My Carrier: Movistar

Re: Keybord Make only numberfield

Developer
Posts: 180
Registered: ‎12-09-2011
My Device: 9360, BB10
My Carrier: Aircel

Re: Keybord Make only numberfield

You can use like this:

 

TextField {
    id: number
    inputMode: TextFieldInputMode.NumbersAndPunctuation
}
Developer
Posts: 148
Registered: ‎01-08-2013
My Device: 9860
My Carrier: Airtel

Re: Keybord Make only numberfield

I want only number 0 to 9 like inputMode: TextFieldInputMode.Pin without A,B,C and D.

Developer
Posts: 271
Registered: ‎05-29-2013
My Device: BlackBerry Z10
My Carrier: MTS

Re: Keybord Make only numberfield

I think it's not possible now. You can't configure virtual keyboard buttons exactly. Also think if user will have a phone with physical keyboard - you can't restrict him from pressing arbitrary keys. Better to check user input.

-------------------------------------------------------------------------------
NSR Reader for BlackBerry 10 @NSRReader on Twitter
Me @xelfium on Twitter
Developer
Posts: 148
Registered: ‎01-08-2013
My Device: 9860
My Carrier: Airtel

Re: Keybord Make only numberfield

Please tell me how to restrict user input.

Developer
Posts: 271
Registered: ‎05-29-2013
My Device: BlackBerry Z10
My Carrier: MTS

Re: Keybord Make only numberfield

You can connect to onTextChanging signal and validate user input.
-------------------------------------------------------------------------------
NSR Reader for BlackBerry 10 @NSRReader on Twitter
Me @xelfium on Twitter
Developer
Posts: 148
Registered: ‎01-08-2013
My Device: 9860
My Carrier: Airtel

Re: Keybord Make only numberfield

I have create a code:

 

  

    TextField {
            id: number
            inputMode: TextFieldInputMode.Pin
            onTextChanging: {
                if(text == "A")
                return false;
            }
        }

 But it is not working.

Developer
Posts: 271
Registered: ‎05-29-2013
My Device: BlackBerry Z10
My Carrier: MTS

Re: Keybord Make only numberfield

If you detect invalid input text then you should correct it and set again in TextField.
-------------------------------------------------------------------------------
NSR Reader for BlackBerry 10 @NSRReader on Twitter
Me @xelfium on Twitter
Developer
Posts: 148
Registered: ‎01-08-2013
My Device: 9860
My Carrier: Airtel

Re: Keybord Make only numberfield

Sorry! I can not uderstand. Please provide example code.