cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Misa
Kudo Kingpin
Kudo Kingpin

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

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.

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Misa ,

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

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

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
rebeccas
Community Champion
Community Champion

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
Community Support
Community Support

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,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@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.

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

Hi @Misa ,

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

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

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@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.

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (1,479)