cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

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
Highlighted
Super User II
Super User II

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


@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

9 REPLIES 9
Highlighted
Anonymous
Not applicable

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

Highlighted
Super User II
Super User II

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


@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


Highlighted
Frequent Visitor

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.

 

Highlighted
Anonymous
Not applicable

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

Highlighted
Anonymous
Not applicable

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

 

Highlighted
Frequent Visitor

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);

Highlighted
Anonymous
Not applicable

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

Highlighted
Frequent Visitor

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

Highlighted
Super User II
Super User II

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


@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

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (5,919)