web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Want to clear a submit...
Power Apps
Unanswered

Want to clear a submitted form's content on checkbox

(0) ShareShare
ReportReport
Posted on by

I have a Sharepoint custom from that has some branching logic meaning that when a checkbox is checked, certain fields are made visible and others are hidden.  The content of those fields must be cleared if the state of the checkbox changes because their content is mutually exclusive, which was easily accomplished BEFORE the form is submitted by using OnCheck and OnUnCheck set to ResetForm(FormName).  I need it to go a step further, so that if the item is EDITED, and the checkbox changes state, then the fields are reset to default or zeroed out.  So far, I am TOTALLY unsuccessful. 

Any help is appreciated!

DML

Categories:
  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @dml set a variable in the oncheck and in the default property of these controls, revert back to the default value if this variable is true. 

  • Darius Lovitt Profile Picture
    on at

    ok- can you explain any further?  There are just too many options for me, a non-developer!  I THINK you're saying something similar to this post: https://powerusers.microsoft.com/t5/Building-Power-Apps/How-to-clear-text-input-fields/td-p/40482 but I really still don't understand.

     

    thx,

    DML

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @dml do you mind sharing u'r screen and u'r formulas

  • Darius Lovitt Profile Picture
    on at

    Sure- Scenario 1, user enters "Vendor Total" and "Percent Requested Payment 1" and "Percent Requested Payment 2", causing "Requested Payment 1 (calculated)" and "Requested Payment 2 (Calculated)" to be automatically calculated.  

    dml_0-1622756808279.png

    Scenario 2- If, however, they want to manually put amounts in for payments 1 and 2, they check the box "Let me manually input payments", and they fill in "Request Payment 1 (static)" and "Request Payment 2 (static)". 

    dml_1-1622757919292.png

     

    In the background, "Request Payment 1 (static)" and "Request Payment 1 (calculated)" are added together to fill in the real field I need -"Request Payment 1" (not shown, but appears in the document library and is used for all workflows, etc) - the REAL result I want and will work against. Same for payment 2. Right now, the checkbox is set to OnCheck and OnUncheck to both call ResetForm(formname) and works fine BEFORE the form is submitted.  If, however, they submit the form and then go back and edit it and change the state of the checkbox, the static or calculated fields (depending on what they already filled in) are NOT cleared out and I end up both static and calculated values, which when added together, throws off the REAL result I need.

     

    Hope this makes sense.  Thx!

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @dml 

    If I understand it right, you want "Request Payment 1 (static)" and "Request Payment 2 (static)" to be reset once Form is submitted.

     

    You can add this code to the OnSuccess() of the Form (please rename controls)

    Reset('Request Payment 1 (static)');

    Reset('Request Payment 2 (static)');

     

    Hope this helps!

  • Darius Lovitt Profile Picture
    on at

    Not exactly.  When the record is opened again after submission, (so Vendor total and either "Request Payment (static)" or "Percent Requested Payment" have data in them and the user changes their mind and wants to use the OTHER scenario, all fields and therefore all calculations are reset and I don't end up with incorrect results.  The scenario is, the user changed their mind after submission...

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @dml OK. you can add

    Reset('Request Payment 1 (static)');

    Reset('Request Payment 2 (static)');

     

    to the OnCheck() and OnUncheck() along with the ResetForm() you had before.

     

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @dml Did you get it to work?

     

    Please remember to give a 👍 and accept the solution as it will help others in the future.

  • Darius Lovitt Profile Picture
    on at

    when i add Reset('Requested Payment 1 (Static)_DataCard1') to the OnCheck value, I get "The function expects a resetable (sic) control as its input". Perhaps i need to put the corresponding DataCardValueX in the reset command? I'll try that...

  • Darius Lovitt Profile Picture
    on at

    no luck.  it's like the "default" is NOT actually <blank> but the current value, if there is a value already entered.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 236 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 188 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 130

Last 30 days Overall leaderboard