'numeric' field type for 'type-in' cards

First, please apologize me in case this has been answered already. I have a strong feeling that it should’ve, but I have no luck finding the answer.

I have a deck where all the cards are type-in, and all the answers are integer numbers (this is a deck I’ve created for my daughter to learn multiplication table). Everything works fine, except that every time the input field is selected, the default keyboard is shown on mobile device, and you need to change it to numeric keyboard first to be able to type the answer.

So the question is, is there a way to somehow mark the field as ‘numeric’, so that numeric keyboard would show up automatically? Something like the ‘inputmode=numeric’ HTML attribute.

1 Like

I cannot test this on mobile but maybe something like the following would work?

<script>
	input = document.getElementById("typeans");
	input.setAttribute("inputmode", "numeric");
</script>

Thanks a lot.
I’ve tried it, and on desktop Anki while debugging with QTWEBENGINE_REMOTE_DEBUGGING I can see in inspector, that the attribute is indeed added to the element. But on mobile apps (both in AnkiMobile and AnkiDroid) for some reason the numeric keyboard is still not shown, and normal keyboard is shown instead. I’ve also tried “type”=“number” and “type”=“tel”, and “pattern”=“[0-9]*” with no luck. Seems like either the script is not working on mobile webviews for some reason or the attributes are just not enough in this case. I’m gonna find out if there is a way to inspect what’s really going on mobile webview, similarly to QTWEBENGINE_REMOTE_DEBUGGING on desktop.

Edit: Nevermind, you actually tried that already.

I don’t know how AnkiMobile works. In AnkiDroid, do this:

  1. Settings > Advanced.
  2. Find Type answer into the card.
  3. Turn this on.

Now, does it work? In my experience, this is basically THE issue when dealing with most AnkiDroid input issues. I tried and the above steps did lead to a resolution.

1 Like