Is there a way to control keyboar type on <input type="text">?


Hi guys,
I’m stacked in a keyboard problem.
i’m trying to create an input type to set currency values, but setting the input as a number type, the keyboard that shows up is the number one (that’s nice). I create a mask to format the values, but in Pt-br (locale ) i need to separate cents values using comma ’ , ’ , that’s where the problem starts, comma can’t be displayed on number inputs and if i use a text input instead, the keyboard that show up on both device types is the default one .

Anyone has any ideia, or had passed through it?!



Can you show us what have you done so far?



I create a a normal form, containing this input.

<label class="item item-input item-stacked-label">
                    <span class="input-label">Total (R$)</span>
                    <input type="number" lang="pt-br" ng-model="evento.cost" currency >
                    <!-- <input type="text" ng-model="test" format="number" />--></label>

After this, i create a directive to mask my input in a currency format.
check the code below.

    .directive('currency', function ($filter) {
        return {
            require: 'ngModel',
            link: function (scope, element, attrs, ctrl) {

                if (!ctrl) return;

                element.bind("keyup", function () {
                    if (ctrl.$viewValue) {
                      //  console.log("KEYUP >> " + ctrl.$viewValue);
                        var result = $filter('currency')(ctrl.$viewValue, {
                            prefix: '',
                            centsSeparator: ',',
                            thousandsSeparator: '.'
                      //  result = result.replace(',','.');
                       // setCaretPosition( setCaretPosition(element[0],ctrl.$viewValue.lenght));



The problem happens because i the input type number don’t allow commas, but if set the input as a text one, the keyboard that shows up to user on mobile devices is the text keyboard.
What made the value insertion difficult.
So i’m trying to manipulate the keyboard to force it to present the number keyboard even when the input were set as a text one.

did you get?

Ps. sorry i know that my english sucks.



this is not exactly you asked for, but: maybe it helps :smile:
virtual keyboard


…or use another type of virtual keyboard :slight_smile:


Hi @Pablo74 ,
did you already use a keyboard like this before?!
It works in both Ios and android devices?


No, I have no experience. I only searched to help you :slight_smile:


Ohh…thanks man.
I’m going to try than i give you a feedback.