[SOLVED] How to show numeric keypad only on mobile phones?

here is the project from where I took this whole code
https://playcanvas.com/project/877545/overview/UIComponents%20with%20DPR
Using this code not able to add number attribute is there any who used same code and
displayed numeric keypad for phone if yes then how ?

Input.attributes.add('type', {
    type: 'string',
    enum: [
        { 'Text': 'text' },
        { 'Email': 'email' },
        { 'Password': 'password' }
    ],
    default : 'text'
});

I wrote this code but while parsing Number input doesnt come

Input.attributes.add('type', {
    type: 'number',
    enum: [
        { 'Text': 'text' },
        { 'Email': 'email' },
        { 'Password': 'password' },
        {'Number': 'number'}
    ],
    default : 'number'
});

This can’t work, as you déclared type: 'number' , so all your enum values and default value have to be numbers, like this :slight_smile:

Input.attributes.add('type', {
    type: 'number',
    enum: [
        { 'Text': 0 },
        { 'Email': 1 },
        { 'Password': 2 },
        {'Number': 3}
    ],
    default : 0
});

My main is aim to show numeric keypad on mobile phones

Works for me here: https://playcanvas.com/editor/scene/1539838

Tried it on mobile and it only brings up the numpad

1 Like

ok great, I will try

Thanks,
Yes its working