cancel
Showing results for 
Search instead for 
Did you mean: 

Numeric Field Type

It would be ideal to have a numeric field field where you can set the number of decimals and only show the numeric keyboard.

Status: Completed

Text inputs now have a property called VirtualKeyboardMode. This is a hint to touch screen devices about what sort of virtual keyboard to use.

  • Text. For entering text in the user's language.
  • Numeric. For entering numbers, including decimals and negative numbers.
  • Auto. Use the same value as the Mode property of the text input.

Support varies depending on device. The keyboard layout and available keys may be different. For example, some Samsung devices do not have negative symbols in the default numeric keyboard. Users can always install a different Android keyboard that is suitable for their needs.

 

Minimum iOS version: 12.2

Recommended Android version: 9.0

Not supported on Windows.

Comments
tahoon
Power Apps
Status changed to: Completed

Text inputs now have a property called VirtualKeyboardMode. This is a hint to touch screen devices about what sort of virtual keyboard to use.

  • Text. For entering text in the user's language.
  • Numeric. For entering numbers, including decimals and negative numbers.
  • Auto. Use the same value as the Mode property of the text input.

Support varies depending on device. The keyboard layout and available keys may be different. For example, some Samsung devices do not have negative symbols in the default numeric keyboard. Users can always install a different Android keyboard that is suitable for their needs.

 

Minimum iOS version: 12.2

Recommended Android version: 9.0

Not supported on Windows.

t12013
Frequent Visitor

Hello 

t12013
Frequent Visitor

Hei, could you guys please add a "-" sign to the numeric keyboard on iOS ?  

I have some input fields where i have to input negative numbers but there isnt a way how to do it, so users have to copy a "-" from somewhere else in the phone. 

 

If anyone else have some sort of workaround it would be nice. i have tried with just "-" in the default field but it doesnt work, 

 

Please add it 🙂

tahoon
Power Apps

As mentioned in the Idea, available keys vary according to device. Power Apps asks for a numeric keyboard and it is up to Android and iOS to decide what keys are included. You can send feedback to Apple that negative symbols should be included in numeric keyboards.

 

You can also set VirtualKeyboardMode to Text to ensure negative symbols are present. However, this will bring up the full keyboard.

t12013
Frequent Visitor

Hello again and thanks for reply. But isnt maybe helpfull to add something like accesory View ? 

 

extension UITextField {

func addNumericAccessory(addPlusMinus: Bool) {
    let numberToolbar = UIToolbar()
    numberToolbar.barStyle = UIBarStyle.default

    var accessories : [UIBarButtonItem] = []

    if addPlusMinus {
        accessories.append(UIBarButtonItem(title: "+/-", style: UIBarButtonItem.Style.plain, target: self, action: #selector(plusMinusPressed)))
        accessories.append(UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: self, action: nil))   //add padding after
    }

    accessories.append(UIBarButtonItem(title: "Clear", style: UIBarButtonItem.Style.plain, target: self, action: #selector(numberPadClear)))
    accessories.append(UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: self, action: nil))   //add padding space
    accessories.append(UIBarButtonItem(title: "Done", style: UIBarButtonItem.Style.plain, target: self, action: #selector(numberPadDone)))

    numberToolbar.items = accessories
    numberToolbar.sizeToFit()

    inputAccessoryView = numberToolbar
}

@objc func numberPadDone() {
    self.resignFirstResponder()
}

@objc func numberPadClear() {
    self.text = ""
}

@objc func plusMinusPressed() {
    guard let currentText = self.text else {
        return
    }
    if currentText.hasPrefix("-") {
        let offsetIndex = currentText.index(currentText.startIndex, offsetBy: 1)
        let substring = currentText[offsetIndex...]  //remove first character
        self.text = String(substring)
    }
    else {
        self.text = "-" + currentText
    }
}

}

 I really struggle with the fact that we cannot add (-) numbers! 
we have to either change all devices to android or leave powerappss and find some other solution.

I really hope you guys can do something 🙂 

tahoon
Power Apps

The above code is for native iOS. Power Apps is based on web technologies. Just like web sites, they cannot control the specific keys shown on a keyboard. They can only request the general type of keyboard. View this site on your device to see what keyboard will appear: https://inputmodes.com/.

 

If it is possible, try installing an alternative keyboard from App Store.

AndrewValenzuel
Advocate II

You could just add an icon with the following variable and math equation next to the text input.

Text Input:

Default:  If(_varNegativeNumber=1, _varUpdatedText, Blank())

Reset: _varNegativeNumber=1

 

Icon:

OnSelect: UpdateContext({_varUpdatedText:Value(TextInput.Text)*-1});UpdateContext({_varNegativeNumber=1});UpdateContext({_varNegativeNumber=0})