Is there a way to make a Prompt only with Numbers allowed?

What I’m trying to do

I want to make a Prompt that only allows Numbers in there (like you restrict a Prompt only use certain Characters).

Things I have tried

First I searched in the Docs for a way to achieve this but the normal Prompt function does not allows that. Also I tried to search for an unusual way to achieve this by using some tricks but I found nothing that talks my Issue. I also thought to make my own user script but I don’t have experience with it as well.

See Inline scripts - QuickAdd and inputPrompt and infoDialog. Basically you just transform your problem to a JavaScript code where your send infoDialog in case of non-numeric values. The approach should be accessible to you if you just modify this code to check if input is numeric:

const input = await this.quickAddApi.inputPrompt("✍");
return `Input given: ${input}`;

Look at the Modal Form plugin – must be installed via BRAT: danielo515/obsidian-modal-form: Define forms for filling data that you will be able to open from anywhere you can run JS (github.com).

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.