cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

Limiting digits in text input?

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, 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Limiting digits in text input?

Hi @PBIUWO ,

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.

 

View solution in original post

2 REPLIES 2
Highlighted
Super User
Super User

Re: Limiting digits in text input?

Hi @PBIUWO ,

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.

 

View solution in original post

Highlighted
Helper II
Helper II

Re: Limiting digits in text input?

@WarrenBelz  

 

Thank you, it worked. 

 

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

Helpful resources

Announcements
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Users online (4,272)