I want the textbox to accept only numeric input

This might help
image

It should work.

1 Like

Thanks for you fast reply.
I tried your suggestion but still it accepts any other character then number and gives this error:
The operation + cannot accept the arguments: , ["-"]

The minus character, -, is a valid character for numbers only (in order to be able to enter a negative number), if submitted on its own,you will need to exclude this with a conditional statement.

In this case I have to write a conditional statement for the other characters like + , . & space also I will need a conditional statement not to allow the user to past a copied data.

Alternatively you can use Taifun's Textbox extension which has event listeners that you can use to control input.

Or you could build your own numeric keyboard with buttons (and hide the soft keyboard with an extension) which would limit data entry...

It only allows "-" for first character and "." one time so no worries

Thanks for your reply,
I tried your suggestion but still it gives same error.

I works with the following:

image

You did not use NumbersOnly?
NumbersOnly
So your looking for any number negative or positive and add 1 to it? If user puts text in then you get a 1 as response.

strange formulae to me
user puts in :
-12 result is -11
-1 result is 0
12 result is 13
0 result is 1
text result is 1

1 Like

This is not true if you use NumbersOnly ... pasting numbers (or negative numbers) are allowed ONLY. NumbersOnly does the work for you

Hi

Already set in text properties to numbers only.

image

Hi
You are right and it gives you a keyboard with numbers only.
But this keyboard shows - , & space which if you use them alone without any number, it result in application failure and close it.

That is interesting because the & is not on my keyboard and the space is but it is disabled.

As far as the negative (-) goes it does not matter because negative numbers are numbers. & and - can easily be removed by the filter I gave .. simple enough. Are you sure your space key is enabled?

JUST curious is all .. your equation has a strange set of numbers for output and makes me wonder how such a set could be viable?

Hi
Sorry my English is weak, I did not mean by & as a character in the keyboard. This is the GBorad I am using:

Try this, uses a label instead of a textbox, and returns the value to a variable on Enter

image

makeAKeyBoardNumbersOnly.aia (20.7 KB)

1 Like

May I ask what happens the next time you press button ? Example text is 5, press button result is 6, next time text input is 6 then result is 7 or 6+6+1=13 ?

Hi
The result would be 7.

Thanks for the nice keyboard.

You could always use regex extension by @Kevinkun to validate numbers for example only integers or even only positives numbers.
For example this will accept only positive integer numbers in calculations otherwise it will return 0 in textbox

2 Likes