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 / Restrict the users to ...
Power Apps
Answered

Restrict the users to enter specific range of numbers

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi Team, 

 

Need your help to restrict the users to enter values between 1900 to 2050. Please help me on this(Formula) .

 

Thanks in advance .

 

Regards,

Mahesh

Categories:
I have the same question (0)
  • OneThing Profile Picture
    393 on at

    Hi Mahesh,

     

    There is no custom Validation of Text inputs in powerapps at the moment unfortunatly.

     

    You can set the input to only accept numbers as a first step.

    Beyond that you can do a check within your submit button before you are allowed to Submit. I.E. Set the Display type to 

    If(Value(TextInput1.text) < 1900 || Value(TextInput1.text) >2050,Disabled,Edit)

    Acompany this with a Label, visible with the same Criteria as above, which says (Please Enter a year beweeen 1900 and 2050, for example) should be ok as a work around.

     

    Thanks,
    Nicky

  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous,

    Do you want to restrict the users to only enter values between 1900 to 2050 within Text Input control?

    Currently, Validate functionality is not supported within Text Input control, so if you want to restrict the users to enter values between 1900 to 2050 within Text Input control directly, I afraid that there is no way to achieve your needs.

    As an alternative solution, please take a try with the following workaround:

    Set the OnChange property of the Text Input control (TextInput1) to following:

    If(
    Value(TextInput1.Text)<1900 || Value(TextInput1.Text)>2050,
    UpdateContext({ShowErrorMsg:true});Reset(TextInput1),
    UpdateContext({ShowErrorMsg:false})
    )

    Set the Text property of a Label control to following:

    "Your must type values between 1900 and 2050."

    Set the Visible property of the Label control to following:

    ShowErrorMsg

    The GIF screenshot as below:Test1.gif

     

    In addition, you could also consider take a try to set the OnChange property of the Text Input control to following:

    If(
    Value(TextInput1.Text)<1900 || Value(TextInput1.Text)>2050,
    Notify("You must type values between 1900 and 2050.",NotificationType.Error);Reset(TextInput1)
    )

    Best regards,

    Kris

  • calerof Profile Picture
    255 on at

    Hi @v-xida-msft ,

    I'm trying to replicate the OnChange formula in my app but it doesn't let me enter any number, it resets immediately to blank.

    error.png

     

    canvas.png

     

    My code is:

    If(
     Value(Calif1.Text) < 0 Or Value(Calif1.Text) > 10, 
     UpdateContext({ShowErrorMsg:true});Reset(Calif1),
     UpdateContext({ShowErrorMsg:false})
    )

     

    Could you please help?

     

    Thank you very much!

     

    Regards,

     

    Fernando

  • calerof Profile Picture
    255 on at

    I figured it out. For some strange reason, the Maximum Length property of the Text Input was fixed to 0, then I couldn't type any number. I restored this value to blank and now this solution works all right.

    Thanks anyway.

     

    error.png

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 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 207 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 150 Super User 2026 Season 2

Last 30 days Overall leaderboard