mrchandoo / cordova-plugin-decimal-keyboard

Cordova plugin to show decimal keyboard on iPhones
Apache License 2.0
37 stars 71 forks source link

Does not work #9

Closed Valkhan closed 6 years ago

Valkhan commented 6 years ago

Tried this plugin with the examples provided, decimals doesn't show at all:

First Test: <input type="text" id="price" pattern="[0-9]*" decimal="true" allow-multiple-decimals="false" decimal-char=".">

My Devices: iPhone 5c and iPhone 6 - Both just the numeric Keyboard appears as expected with the pattern (no plugin required) but no decimals.

Android: Gran Duos - numeric keyboard missing.

Second Test: <input type="number" id="price" pattern="[0-9]*" decimal="true" allow-multiple-decimals="false" decimal-char=".">

My Devices: iPhone 5c and iPhone 6 - Both just the numeric Keyboard appears as expected with the pattern (no plugin required) but no decimals..

Android: Gran Duos - numeric keyboard appears with no decimals.

Is there any way I can test if this plugin is actually doing something? Tried this to check if it was loaded with partial success:

$$(document).on('deviceready', function() {
    if(DecimalKeyboard){
        myApp.alert('Decimal Loaded');
    } else {
        myApp.alert('Decimal not Loaded');
    }
});

Testing in browser I get 'Decimal loaded' message, on android or ios devices I get DecimalKeyboard is undefined.

$$(document).on('deviceready', function() {
    if(window.DecimalKeyboard){
        myApp.alert('Decimal Loaded');
    } else {
        myApp.alert('Decimal not Loaded');
    }
});

Testing in browser I get 'Decimal loaded' message, on android or ios devices I get 'Decimal not Loaded'.

mrchandoo commented 6 years ago

At first - this plugin doesn't support Android. This is iOS only plugin and for android you can use a pattern which matches your need.

Second this is a device plugin and doesn't work on browser, and I would expect the plugins not be loaded when you open the application in browser, unless you mock the existing methods to behave seamlessly on browser.

Coming to the issue - I don't think the plugin is correctly loaded, can you create a clean project and add this plugin ? If you have Xcode and if you are debugging you can keep a breakpoint in the plugin .m file or you can see safari to know if there are any errors in the console.

P.S: it is usually some small typos but this plugin does work and many are already using it

Valkhan commented 6 years ago

@mrchandoo Now that you've said that it doesn't work on Android as well, I'll probably search for another solution (html/css/javascript based instead of native keyboard, I was using framework7 keypad plugin and probably will continue using it), but I was mislead here by cordova apache plugins website: https://cordova.apache.org/plugins/?q=decimal%20keyboard as it shows this plugin as an Android compatible OS.

If you can do something about that on Cordova Website that'll be great, that's it for now, thank you for your time and you may close this issue.

mrchandoo commented 6 years ago

Thanks, I do not have control over the post in Cordova plugins as it was not posted by me.