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
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (1,302)