cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
A_San
Helper I
Helper I

Method to clear field

We created a form to submit nominations which will get saved as list in Sharepoint. We have a field called "Need More Info" which is a text box with multiple lines. If the nominator provides more information as requested, there should be a method to clear what's in the "Needs More Info" Field. Created a button called "Clear" next to it hoping that when clicked it should clear the text in the "Needs More Info" Field with Reset() command. But it expects the default value of "Needs More Info" Field to be blank or "". Currently is it Parent.Default. When I make it " " , it is not displaying the data in the field at all. Any help would be appreciated. New to powerapps.

2 ACCEPTED SOLUTIONS

Accepted Solutions
WarrenBelz
Super User III
Super User III

Hi @A_San ,

If I am reading this correctly, you want to clear the box and also clear anything in the field (Parent.Default) already in the data?
You could do it with a Variable on the Button - OnSelect

UpdateContext({vReset:true});
Reset(YourTextBoxName)

then the Default of your Text box

If(
   vReset,
   Blank(),
   Parent.Default
)

then on any screen exit or save, add this

UpdateContext({vReset:false})

 

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.

 

View solution in original post

@A_San ,

Sorry - that is actually the card not the control - it is a bit difficult deciphering pictures.

I go back again to my previous post - is your TextBox named InformationNeeded (the same as the field). If so, change it now to something else (as an example InfoNeeded) - then your Update will be InfoNeeded.Text.

This is not difficult issue - your card Update simply needs to be the output of the control and you should not name this the same as the field as this leads to Ambiguity.

 

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.

 

 

View solution in original post

22 REPLIES 22
WarrenBelz
Super User III
Super User III

Hi @A_San ,

If I am reading this correctly, you want to clear the box and also clear anything in the field (Parent.Default) already in the data?
You could do it with a Variable on the Button - OnSelect

UpdateContext({vReset:true});
Reset(YourTextBoxName)

then the Default of your Text box

If(
   vReset,
   Blank(),
   Parent.Default
)

then on any screen exit or save, add this

UpdateContext({vReset:false})

 

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.

 

View solution in original post

@WarrenBelz . 

Thank you for your quick response.

"If I am reading this correctly, you want to clear the box and also clear anything in the field (Parent.Default) already in the data?" - Yes that is correct.

I tried your steps but seeing this error - screenshot below. Please advice what I am missing.

 

SS1.PNG  SS2.PNG

 

 

@WarrenBelz 

Please ignore my previous message. It is not showing any error. However, when I clicked on clear, it made the field blank but when I clicked on save changes on my form, it brought back the text("abcdef" for example) in the field. I have already given : 

UpdateContext({vReset:false})  in the OnSelect of "Save Changes". Please advice.

 

SS3.PNG

 

@A_San,

What is the Update property of the data card and I assume you are using SubmitForm() to save the data?

@WarrenBelz ,

 

I don't see an update property for the datacard. Yes I am using SubmitForm() to save data.

Did you place UpdateContext({vReset:false}) after SubmitForm() or before?

@Alex_10  After submitform(). 

what if you try this for TextInput.Default:

If(
vReset,
"",
Parent.Default
)

OR after SubmitForm
Refresh(yourDataSource)

@Alex_10 Still not working. It is clearing the text box but when I click on Save Changes, it comes back on the text box.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (68,910)