web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Number field validatio...
Power Apps
Answered

Number field validation. Input contains whole numbers only..

(0) ShareShare
ReportReport
Posted on by 77

I have a text field with the format as numbers. 
I want the input numbers to be whole numbers(Decimals not allowed) including zero.

 

Currently, I'm using the below code on the OnChange property. But it is not allowing 0.

If(
Value(TextField.Text) / Value(
RoundDown(
Value(TextField.Text),
0
)
) <> 1,
Notify(
"Decimals not allowed,please try again!",
NotificationType.Error
);
Reset(TextField)
)

Categories:
I have the same question (0)
  • Verified answer
    rbrooks66 Profile Picture
    143 on at

    This works in my text box, doing the exact same thing.  I didn't like the way Notify was displayed and liked having the label made visible or invisible based on the entry in the units text box.

    Sorry, original post was backward.

     

    I have a hidden label with the message "No decimals!"

     

     

    If((Value(Units.Text)<>RoundDown(Value(Units.Text),0)) And (!(IsBlank(Units.Text))),true,false)

     

    Then, if they try to tab out of the text box, I reset the value.

     

    If(Value(Units.Text)<>RoundDown(Value(Units.Text),0), SetFocus(Units); Reset(Units))

     

     

     

  • pranavj619 Profile Picture
    77 on at

    I'm gonna use notify. But still your code is working.. Now I can accept 0 as input

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 400 Most Valuable Professional

#2
11manish Profile Picture

11manish 141 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 109 Super User 2026 Season 2

Last 30 days Overall leaderboard