Mottie/Keyboard

Changing decimal separator in numpad

Closed this issue · 2 comments

Hello and thanks for this great keyboard,

I'm having a problem when changing the decimal separator from dot(.) to comma(,).

This is how i add a keyboard in a textarea:

    $(document).ready(function () {
       $('.keyboard').keyboard({
            layout: 'num',
            display: {
                'dec': ',:Decimal'
            }
        });
    });

Why is the decimal separator not changing though?
I tried reading through your code, but the keyset you pass as an argument when adding keys in the keyboard, the dot is always used.

Hi @dnpall!

The problem here is that in the basic numpad, I forgot to replace the . with the {dec} action key. I'll fix this in the next update, but you can get around it by adding a custom numpad like this (demo):

$(function () {
    $('.keyboard').keyboard({
        layout: 'custom',
        customLayout: {
            'normal' : [
                '= ( ) {b}',
                '{clear} / * -',
                '7 8 9 +',
                '4 5 6 {sign}',
                '1 2 3 %',
                '0 {dec} {a} {c}'
            ]
        },
        display: {
            'dec': ',:Decimal'
        }
    });
});

Thank you very much, keep up the good work!