# Action Button - resetOnChange for a table

**URL:** <https://cl.desmos.com/t/action-button-resetonchange-for-a-table/2532>\
**Category:** Questions\
**Tags:** validation, correctness\
**Created:** [February 1, 2021, 11:39pm UTC](https://cl.desmos.com/t/action-button-resetonchange-for-a-table/2532 "2021-02-01T23:39:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pamela\_Davis](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/pamela_davis/32/1890_2.png) [@Pamela\_Davis](https://cl.desmos.com/u/Pamela_Davis)\
**Post date:** [February 1, 2021, 11:39pm UTC](https://cl.desmos.com/t/action-button-resetonchange-for-a-table/2532/1 "2021-02-01T23:39:32Z")

</div>

I’ve been researching how to write a reset for the Action button for when a student changes their answer in a table. I have it set up so once a student enters their response and hits the “Check your answer” button they get “Correct” or “Try again”. If a student is incorrect and they get the “Try again”, I would like the button to reset to “Check your answer” when they make a change to the table. Everything I have read is for graphing so I don’t know how to translate it to a table.

Here’s my Action button coding:  
a = t1.cellNumericValue(1,2)  
b = t1.cellNumericValue(1,3)  
count = button1.pressCount

capture(“a”): a  
capture(“b”): b

disabled: button1.pressCount\>0 and button1.lastValue(“a”)=numericValue(“1/3”) and button1.lastValue(“b”)=numericValue(“0.333”)

label: when (button1.pressCount=0) “Check your answers”  
when not(button1.lastValue(“a”)=numericValue(“1/3”) and button1.lastValue(“b”)=numericValue(“0.333”)) and (count = 1) “\n\n\Incorrect! Try again!”  
when not(button1.lastValue(“a”)=numericValue(“1/3”) and button1.lastValue(“b”)=numericValue(“0.333”)) and (count = 2) “\n\n\Still incorrect! Try again!”  
when not(button1.lastValue(“a”)=numericValue(“1/3”) and button1.lastValue(“b”)=numericValue(“0.333”)) and (count \> 2) “\n\n\Try looking for a pattern in the fractions or check your 3 sf and then try again!”  
when (button1.pressCount\>0 and button1.lastValue(“a”)=numericValue(“1/3”) and button1.lastValue(“b”)=numericValue(“0.333”)) “\n\n\Correct!\n\nContinue to the next screen.”  
otherwise “Check your answers”

Thank you!

---

<div class="post-metadata">

**Author:** ![cwinske](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/cwinske/32/3106_2.png) [@cwinske](https://cl.desmos.com/u/cwinske)\
**Post date:** [February 2, 2021, 11:38am UTC](https://cl.desmos.com/t/action-button-resetonchange-for-a-table/2532/2 "2021-02-02T11:38:34Z")

</div>

The resetOnChange basically turns a button from “pressed” to “not pressed,” which also resets the timeSincePressed. I’m going off of memory here, but I’m pretty sure you can just add `resetLabel: "Edit my response"` in the CL and then any changes to the table will reset the timer.

I use resetOnChange for moving points on a graph. For example, if you submit a graph as an answer and receive feedback, I might not want the feedback to remain in the note if a point is moved.
