Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

How do I flag a required text field in a form, and display and error message, if the data that is entered is not an integer that is 5-7 digits long?

(0) ShareShare
ReportReport
Posted on by 821 Super User 2025 Season 1

I have a form with a required text field. It throws an error if you try to submit the form but there is no value in it. That's fine but I want to prevent a user from submitting the form if the text field does not contain a 5-7 digit integer much like you prevent the form from being submitted if the field was blank. At the same time, I want to show an error message if the field does not contain a 5-7 digit. How can I do this? 

  • WarrenBelz Profile Picture
    146,524 Most Valuable Professional on at
    Re: How do I flag a required text field in a form, and display and error message, if the data that is entered is not an integer that is 5-7 digits long?

    @futr_vision ,

    Please see revised code

  • futr_vision Profile Picture
    821 Super User 2025 Season 1 on at
    Re: How do I flag a required text field in a form, and display and error message, if the data that is entered is not an integer that is 5-7 digits long?

    Adding to the OnChange doesn't actually do anything for me. No errors either. How would I troubleshoot this?

  • WarrenBelz Profile Picture
    146,524 Most Valuable Professional on at
    Re: How do I flag a required text field in a form, and display and error message, if the data that is entered is not an integer that is 5-7 digits long?

    @futr_vision ,

    There would be several options - example OnChange of the Text Box

    If(
     Value(Self.Text) < 10000 || Value(Self.Text) > 9999999
     Reset(Self);
     Notify("Must contain . . . . .")
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • futr_vision Profile Picture
    821 Super User 2025 Season 1 on at
    Re: How do I flag a required text field in a form, and display and error message, if the data that is entered is not an integer that is 5-7 digits long?

    Where would I be using this formula and how would I trigger the error or does that happen natively if the condition is not met?

  • WarrenBelz Profile Picture
    146,524 Most Valuable Professional on at
    Re: How do I flag a required text field in a form, and display and error message, if the data that is entered is not an integer that is 5-7 digits long?

    Hi @futr_vision ,

    You could use the test

    Value(YourTextInput.Text) > 9999 && Value(YourTextInput.Text) < 10000000

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,524 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,906 Most Valuable Professional

Leaderboard