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 / Limiting digits in tex...
Power Apps
Answered

Limiting digits in text input?

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi All,

 

I have an app where users can type in the date. 

It is not a calendar as this is faster to do than selecting specific dates from the calendar.

 

The format is "YYMMDD", is there a way to limit the number for the digits so the "MM" cannot be greater than 12 (December) and "DD" cannot be greater than 31. 

If not possible, maybe changing the first M to be 0 or 1. Second M to be 0 to 9. D to be 0-3, Second D to be 0-9

 

Currently, the background changes from red to white, when in the correct format. If there is no way to limit it, maybe to change the background colour to show that it's in the wrong format. 

 

Thank you, 

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    155,779 Most Valuable Professional on at

    Hi @Anonymous ,

    Firstly make sure you have 6 characters

    If(
     Len(YourTextBoxName.Text)<>6,
     Notify("Must have six numbers in YYMMDD format",Error)
    )

    Now for the day

    If(
     Value(
     Right(YourTextBoxName.Text,2)
     )>31,
     Notify("Date cannot be greater than 31",Error)
    )

    and the month

    If(
     Value(
     Mid(YourTextBoxName.Text,3,2)
     )>12,
     Notify("Month cannot be greater than 12",Error)
    )

    These use notifications - also if you put this on the OnChange of the text box, you can replace the text box name with Self

    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.

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @WarrenBelz  

     

    Thank you, it worked. 

     

    I made it a notification, and also disabled the submit button if the format is wrong. 

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 477

#2
WarrenBelz Profile Picture

WarrenBelz 341 Most Valuable Professional

#3
11manish Profile Picture

11manish 317

Last 30 days Overall leaderboard