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

How to make label visible true click on create button

Hi,

I want to make Error label visible true if Textinput is blank. I have written the code below.

 

If(Isblank(txtinput.text),Errormessage1.visible=true,Errormessage1.visible=false);

 

I don't want to create context variables becasue there are many fields in my form. So, I have to create for each field one variabele. when I click on create button and I need to validate the form.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: How to make label visible true click on create button

You can't do that in PowerApps - you can't set another item's property directly.
You must either use a context variable or a global variable, then set the visible property of that item to the context/global variable.

 

The way the language and platform is designed is similar to Microsoft Excel, whereby you can't use a standard formula in one cell to directly change another cell's content.

 

This snippet from https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/working-with-variables
shows how variables are used as you can't directly edit properties like you can with other languages:

 

image.png




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!

View solution in original post

9 REPLIES 9
Vasii
Level 8

Re: How to make label visible true click on create button

Hello nagamanikanta,

 

you have to change the Visible property of your label like

 

If(IsBlank(TextInput1),true,false)

 

Let me know if that works. 🙂

 

Best regards

Vasii

Super User
Super User

Re: How to make label visible true click on create button

Hi,


You should be able to just change the Visible property of the error message label itself:

Change the Visible property of your error message label to:

 

If(
    IsBlank(txtinput.text),
       true,
       false
)

 

Cheers,

@iAm_ManCat




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!
nagamanikanta
Level: Powered On

Re: How to make label visible true click on create button

But I need to make label visible when i click on Create button. It needs to check whether text input is blank or not.

 

Vasii
Level 8

Re: How to make label visible true click on create button

Than you have to use UpdateContext({showLabel:true}) on the OnSelect property of your button and in the label visibility you should write showLabel.

 

Best regards

Vasii

Vasii
Level 8

Re: How to make label visible true click on create button

If you would make required inputs or something, it would be easier to set the DisplayMode property of the button to disabled if the inputfield is blank like

 

If(IsBlank(TextInput1),disabled,edit)

 

 

Best regards

Vasii

 

nagamanikanta
Level: Powered On

Re: How to make label visible true click on create button

Below code will work onselect property of create button?

If(Isblank(txtinput.text),Errormessage1.visible=true,Errormessage1.visible=false);

Vasii
Level 8

Re: How to make label visible true click on create button

Try to use this code in the OnSelect property of your create button

If(IsBlank(TextInput1),UpdateContext({showLabel: true}),UpdateContext({showLabel: false}))

and insert "showLabel" in the Visible property of your errorlabel.

 

 

Best regards

Vasii

nagamanikanta
Level: Powered On

Re: How to make label visible true click on create button

My requirement is not to create context variables(updatecontext()) to make label visible by using  this code If(Isblank(txtinput.text),Errormessage1.visible=true,Errormessage1.visible=false);  I have to make label visible

Super User
Super User

Re: How to make label visible true click on create button

You can't do that in PowerApps - you can't set another item's property directly.
You must either use a context variable or a global variable, then set the visible property of that item to the context/global variable.

 

The way the language and platform is designed is similar to Microsoft Excel, whereby you can't use a standard formula in one cell to directly change another cell's content.

 

This snippet from https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/working-with-variables
shows how variables are used as you can't directly edit properties like you can with other languages:

 

image.png




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!

View solution in original post

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: 186 members 4,547 guests
Please welcome our newest community members: