I'm trying to force a Text Input control to accept only integers but it isn't working so far.
Right now I'm using the following code in the OnChange property of the Text Input control:
If(Value(TextInput.Text ) <> RoundDown(Value(TextInput.Text),0), Set(resetTextBox, true));Set(resetTextBox, false)
The Reset property of this control is set to the resetTextBox variable.
Has anyone accomplished this in a different way?
Could you explain what it is about your code that doesn't work?
In the test that I carried out, the text input control accepts whole numbers. If the input value includes numbers after the decimal point, the text input control clears itself. Are you expecting some different behaviour?
Hope this Helps!
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Hi @timl , yes there is a limitation where it allows the decimal point but at the same time we can reset the control as soon as a non-number character is identified, user does not need to move out of the control to see the changes/ reset the textbox. And for removing the decimal value, I think the code @Eduardo_GzzC used will suffice the requirement.
Hi, thanks for the answers so far. The code is working after I click outside as expected. I just wanted something that prevents even typing the decimal point. Like when you choose a number as a format and it won't accept text.
I guess it would have to be like this for the moment until I find a workaround.
Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.
Continue your learning in our online communities.
Features releasing from October 2019 through March 2020
Coming to a city near you
Fill out a quick form to claim your user group badge now!
Connect, share, and learn with your peers year-round