cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Gina-PowerApps
Frequent Visitor

Validate Text Input - Add Letter 'U'

Hi there, 

 

Sorry this is probably a simple fix but I have searched high and low! 

 

We have a text input control for a Staff Number... all our staff numbers start with U and during testing, some people were only entering the numbers without the U, despite writing 'Include 'U'' on both the question and within the help text. 

 

Ideally, we would either like to pre-populate the box with U and then they can type their 6 digits, or we need an error message to not letter them submit without a U in the front of the staff number. 

 

Already have this set up on our submit display mode which greys out the button if they don't have a name or staff number -

If(IsBlank(CrewFirstName.Text) || IsBlank(CrewStaffNo), DisplayMode.Disabled, DisplayMode.Edit)

 

Would anyone be able to please help either add the U to the front of the text input or add a validation to the submit button, or both please? 🙂 Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
iAm_ManCat
Super User
Super User

Heya,

 

Yes, we can use Left() to check whether the first character is a U, like this:

 

If(
   IsBlank(CrewFirstName.Text)
   || IsBlank(CrewStaffNo.Text)
   || Not(Upper(Left(CrewStaffNo.Text,1))="U"), 
   DisplayMode.Disabled, 
   DisplayMode.Edit
)

 

Cheers,

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


View solution in original post

3 REPLIES 3
iAm_ManCat
Super User
Super User

Heya,

 

Yes, we can use Left() to check whether the first character is a U, like this:

 

If(
   IsBlank(CrewFirstName.Text)
   || IsBlank(CrewStaffNo.Text)
   || Not(Upper(Left(CrewStaffNo.Text,1))="U"), 
   DisplayMode.Disabled, 
   DisplayMode.Edit
)

 

Cheers,

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


Amazing, thank you so much! 

Happy to help, have a great rest of the week!

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (5,286)