cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Error using updatecontext

So basically I want to make a field visible when a field is empty. The following code is inside of my button at OnSelect: 

If(IsBlank(DataCardValue22.Text); UpdateContext({VarError:true}) 

Now on the Visible of my errormessage label I have this: 

VarError

But this gives me an error. What am I doing wrong? 

1 ACCEPTED SOLUTION

Accepted Solutions

Okay now I understood

If(IsBlank(DataCardValue22.Text), UpdateContext({VarError:true}),UpdateContext({VarError:false})  )

give like this 

 

In screen on visible property  add code as 

UpdateContext({VarError:false})

View solution in original post

8 REPLIES 8
mdevaney
Super User
Super User

@Anonymous 
Can you please supply a screenshot of the error message you are receiving in the Visible of your errormessage label?

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Anonymous
Not applicable

Anonymous
Not applicable

Anyone knows a fix?

SumanKoduri
Helper V
Helper V

 

 

If(IsBlank(DataCardValue22.Text); UpdateContext({VarError:true}) 

 

 

Yes, your code should be like this 

 

 

If(IsBlank(DataCardValue22.Text), UpdateContext({VarError:true}) )

 

 

But this VarError variable will get value only when you click that data card so it's better to write your condition in error message 14 label visible property add code as IsBlank(DataCardValue22.Text)

test.PNG

In error message Add some text to check whether it shows message when that data card value is empty

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Anonymous
Not applicable

Sorry, I did not explain what I wanted in my application. I do not want the error message to be always visible if that datacard is empty. I only want it to give the error when they click on the "Submit" button of the form. That's why I've used that code. 

@SumanKoduri 

Okay now I understood

If(IsBlank(DataCardValue22.Text), UpdateContext({VarError:true}),UpdateContext({VarError:false})  )

give like this 

 

In screen on visible property  add code as 

UpdateContext({VarError:false})

Is it fixed or you have any issue still

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

Anonymous
Not applicable

All good! Thanks so much!

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (4,093)