Numeric Entry Keypad

Just starting out? Need help? Post your questions and find answers here.
matalog
Posts: 14
Joined: Fri Dec 04, 2020 6:07 am

Numeric Entry Keypad

Post by matalog »

I have asked before, and just checking, there is no way to access this type of numeric keypad from SpiderBasic?

Image
hoerbie
Posts: 137
Joined: Sun Mar 17, 2019 5:51 pm
Location: DE/BY/MUC

Re: Numeric Entry Keypad

Post by hoerbie »

Sorry, but there is no pic, so maybe I'm wrong.

But if you want to open a special keypad on a mobile phone when clicking into a StringGadget, on Android a function like this works, if you call it with the ID-number of the StringGadget:

Code: Select all

Procedure SetStringGadgetKeyboard(id.i, kbdt.u)
  If kbdt = 1
    ! spider_GadgetID(v_id).gadget.textbox.setAttribute('inputmode','decimal');
  ElseIf kbdt = 2
    ! spider_GadgetID(v_id).gadget.textbox.setAttribute('inputmode','numeric');
  ElseIf kbdt = 3
    ! spider_GadgetID(v_id).gadget.textbox.setAttribute('inputmode','email');
  Else
    ! spider_GadgetID(v_id).gadget.textbox.setAttribute('inputmode','text');
  EndIf
EndProcedure
Quin
Posts: 118
Joined: Wed Nov 08, 2023 4:38 pm

Re: Numeric Entry Keypad

Post by Quin »

hoerbie wrote: Sat Mar 08, 2025 2:39 pm Sorry, but there is no pic, so maybe I'm wrong.

But if you want to open a special keypad on a mobile phone when clicking into a StringGadget, on Android a function like this works, if you call it with the ID-number of the StringGadget:

Code: Select all

Procedure SetStringGadgetKeyboard(id.i, kbdt.u)
  If kbdt = 1
    ! spider_GadgetID(v_id).gadget.textbox.setAttribute('inputmode','decimal');
  ElseIf kbdt = 2
    ! spider_GadgetID(v_id).gadget.textbox.setAttribute('inputmode','numeric');
  ElseIf kbdt = 3
    ! spider_GadgetID(v_id).gadget.textbox.setAttribute('inputmode','email');
  Else
    ! spider_GadgetID(v_id).gadget.textbox.setAttribute('inputmode','text');
  EndIf
EndProcedure
Whoa, now that's a cool trick. I'm not OP, but it works here, thanks for sharing!
matalog
Posts: 14
Joined: Fri Dec 04, 2020 6:07 am

Re: Numeric Entry Keypad

Post by matalog »

hoerbie wrote: Sat Mar 08, 2025 2:39 pm Sorry, but there is no pic, so maybe I'm wrong.

But if you want to open a special keypad on a mobile phone when clicking into a StringGadget, on Android a function like this works, if you call it with the ID-number of the StringGadget:

Code: Select all

Procedure SetStringGadgetKeyboard(id.i, kbdt.u)
  If kbdt = 1
    ! spider_GadgetID(v_id).gadget.textbox.setAttribute('inputmode','decimal');
  ElseIf kbdt = 2
    ! spider_GadgetID(v_id).gadget.textbox.setAttribute('inputmode','numeric');
  ElseIf kbdt = 3
    ! spider_GadgetID(v_id).gadget.textbox.setAttribute('inputmode','email');
  Else
    ! spider_GadgetID(v_id).gadget.textbox.setAttribute('inputmode','text');
  EndIf
EndProcedure
That's amazing thatnk for sharing it. Are there any other input options?
hoerbie
Posts: 137
Joined: Sun Mar 17, 2019 5:51 pm
Location: DE/BY/MUC

Re: Numeric Entry Keypad

Post by hoerbie »

It's my pleasure to share...
The above was what I needed for my app, but some googling will give more types, for example
https://developer.mozilla.org/en-US/doc ... /inputmode
https://css-tricks.com/everything-you-e ... inputmode/
You will have to find out, what really works with different Android oder iOS versions and their different keypads. I use a lot devices from Sunmi, there are some cheap ones with Android 7.1, there you need to install a software keypad, for example GBoard from Google, to let the input mode work, on more expensive newer one with Android >= 9 the above types work.
matalog
Posts: 14
Joined: Fri Dec 04, 2020 6:07 am

Re: Numeric Entry Keypad

Post by matalog »

Absolutely brilliant. Thank you.
Post Reply