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 / Conditional visibility...
Power Apps
Answered

Conditional visibility based on whether the field letter is a "B" and based a count of characters in a text field

(0) ShareShare
ReportReport
Posted on by 248

Hi all.   Hope you are having a wonderful day!

 

I have 2 visibility fields that need to be based on a condition.

 

1) A label with text would be hidden until the user starts entering data that does not begin with the letter "B" or "b" into field 1.

 

2) 2nd field would not allow the user to fill out any other fields or click outside of the data until 21 characters were entered into the 2nd field. 

 

I tried the Count and Len functions would not work. 

 

Thank you for the help.

Categories:
  • rebeccas Profile Picture
    2,591 on at

    The first would be:

     

    Visible= If(IsMatch(TextInput1.Text,"b",Contains) || IsMatch(TextInput1.Text,"B",Contains),true, false)

     

    I'm still thinking on the second...few ways you could go.

  • v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi @Misa ,

    1)I assume that you want to decide a label's visible based on the data entered in a textinput.

    Try this formula: (set the label's Visible)

    If(StartsWith(TextInput1.Text,"B")||StartsWith(TextInput1.Text,"b"),false,true)

     

    2)I'm afraid it's not supported to "not allow the user to fill out any other fields or click outside of the data" currently in PowerApps.

    As anlternative way, I suggest you make other controls disabled until 21 characters were entered into the 2nd textinput.

    Try this:

    Set other controls' DisplayMode: 

    If(Len(TextInput2.Text)>=21,DisplayMode.Edit,Disabled)

     

    Best regards,

  • Misa Profile Picture
    248 on at

    @v-yutliu-msftHello.

     

    Correct but i wanted the textinput to only be visible if the datacardvalue did not start with a B. I inverted the true/false from your example above.  I was hoping that the label would be hidden until the user started typing and would appear appropriately.  I tried using Not and ! with Startswith and it did not work.  

     

    Thank you again for your time.

  • Misa Profile Picture
    248 on at

    @rebeccas 

     

    Thank you for your response.  Like v-yutliu-msft the result is the same.  It's still pretty awesome and i will be able to use it on another form.  

     

    I would like for the label to be hidden until the user starts typing in the datacard.  

     

    Thanks again for your tie as well!

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

    Hi @Misa ,

    Please try this:  (Set the label's Visible)

    If(Not(StartsWith(TextInput7.Text,"B")||StartsWith(TextInput7.Text,"b")),true,false)

     

    Best regards,

  • Misa Profile Picture
    248 on at

    @v-yutliu-msft 

     

    Hi and thank you again for the response.  I was able to try the new formula using NOT and it did't work at first.  I added an ISBLANK (If(IsBlank(DataCardValue5.Text), false, If(Not(StartsWith(DataCardValue5.Text,"b") || StartsWith(DataCardValue5.Text,"B")),true, false)) and that gave me the results.

     

    Thank you so much for all your help.

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 283

#3
Mohsin Ali Profile Picture

Mohsin Ali 221

Last 30 days Overall leaderboard