cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
lmauriceparker
Level: Powered On

Password Protecting Screens

I want to create a textbox, a button, and a label.

 

If textbox = "something", when the button is pressed, I want to navigate to another screen.

 

If the textbox contains the wrong value, I want the label to display an error message ("Incorrect. Please try again.").

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Re: Password Protecting Screens

Hi @lmauriceparker you are getting an error becouse you are trying to check a complex object TextInput4 to a string which is "something" and it fails as you can not comapre object to a string. TextInput4 contains many different attributes to get its text value (string) in the formula write:

!(TextInput4.Text = "Something")

 

In Object orianted programming you first select the object (TextInput4) and by adding a . you select one of its attributes, in our case its Text attribute of TextInput4 object. This way there is no errors as it compares string to string 

View solution in original post

7 REPLIES 7
mr-dang
Level 10

Re: Password Protecting Screens

There's two things you can do:

1. Disable the button unless the condition is true

Set Button.Disabled to:

!(TextBox="something")

 

This means, "Grey out the button if the Textbox is not equal to "something.""

 

2. Place the condition in the OnSelect property so that only if the condition is true, the button will work.

 

Set Button.OnSelect to:

If(TextBox="something",Navigate(Screen2,Fade))

This means, "As long as TextBox equals "something," perform the actions of the Button."

Microsoft Employee
@8bitclassroom
Community Support Team
Community Support Team

Re: Password Protecting Screens

Hi @lmauriceparker

 

Please follow what mr-dang suggested to configure the Button's Disabled, or the Onselected property.

For the error notification, you could change the the Text property of the Button with the formula below:

If(TextInput1.Text="Something",
    "Click Here",
    "Incorrect"
  )

Then change the Color property of the Button control with the formula below:

If(TextInput1.Text="Something",
   RGBA(255,255,255,1),
    RGBA(255,1,1,1)
)

Doing in this way would show the Text in Button, if condition met, Click Here in whilte color, if not met, Incorrect in red color.

 

Further, if a Label is needed without changing the Text property of Button, change the Text Property of the Label with the Text below:

"Incorrect. Please try again."

Color property to:

RGBA(255,41,43,1)

And Visible Property to:

If(TextInput1.Text="Something",
    false,
     true)

In this way, the error messge in the Label would show out in red color unless the condition is met, which then become invisible.

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
lmauriceparker
Level: Powered On

Re: Password Protecting Screens

error1.jpg

I tried option 2 and I got this notification.

 

"If(TextInput4="something",Navigate(Homepage,ScreenTransition.Cover))".

Community Support Team
Community Support Team

Re: Password Protecting Screens

It should be:

TestInput4.Text ="Something"

 

Further, it is not option 2 (suggested by mr-dang.)

You should configure both the Disabled property and the OnSelected property.

 

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
lmauriceparker
Level: Powered On

Re: Password Protecting Screens

error2.jpg

Same message using disabled. I'm using a textinput box.

Anonymous
Not applicable

Re: Password Protecting Screens

Hi @lmauriceparker you are getting an error becouse you are trying to check a complex object TextInput4 to a string which is "something" and it fails as you can not comapre object to a string. TextInput4 contains many different attributes to get its text value (string) in the formula write:

!(TextInput4.Text = "Something")

 

In Object orianted programming you first select the object (TextInput4) and by adding a . you select one of its attributes, in our case its Text attribute of TextInput4 object. This way there is no errors as it compares string to string 

View solution in original post

Highlighted
lmauriceparker
Level: Powered On

Re: Password Protecting Screens

PERFECT!! Thank you all! It works!

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 185 members 4,560 guests
Please welcome our newest community members: