Error Message Struggles

So, I’m trying to edit one of my activities to make it more students self-paced. My goal is to have students type the ‘set-up’ into the table first and get that all correct prior to typing their final answer into the input. So I’m trying to use the errorMessage sink, but I’m struggling- When I type the table correctly the error message doesn’t go away? Any ideas/suggestions, advice? I want to use this technique for the whole activity, which will have some more complex tables later on, so I want to make sure I understand how to do this for the smaller one.

Table Code:

checkf1=simpleFunction(a1).evaluateAt(1)=1 and simpleFunction(a1).evaluateAt(3)=3

checkf2=simpleFunction(a2).evaluateAt(1)=1 and simpleFunction(a2).evaluateAt(3)=1



when checkf1 “:grin:
otherwise “:cry:

when checkf2 “:grin:
otherwise “:cry:

when checkf3 “:grin:
otherwise “:cry:

when checkf4 “:grin:
otherwise “:cry:

readOnly: true

Input Code:
suffix: “+C”

errorMessage: when (not(Table1.script.checkf1 and Table1.script.checkf2 and Table1.script.checkf3 and Table1.script.checkf4 and Table1.submitted) or not(Table1.submitted)) “Go back and check your table set up.” otherwise “”

check1=simpleFunction(q1.latex).evaluateAt(0)=-1 and (simpleFunction(q1.latex).evaluateAt(1)>-0.8 and simpleFunction(q1.latex).evaluateAt(1)<-0.7)

correct: (check1)

Slide: Error Code • Activity Builder by Desmos

Thanks, Everyone!

When I checked the activity, there wasn’t a submit button attached to the table. Try removing the table1.submitted parts from the errorMessage or insert submitButtonText: “Submit Table” in the table component and it should work.

Quick heads up about table buttons: We’re no longer supporting them.

But now that you can attach an action button to a table, you can use that!

I’ve never tried using the action button before. Any suggestions for me to look at so I can learn how it works? I assume I need to write something in the CL layer so that the table has to be submitted and correct so the error message goes away?

This is from a different section of the documentation but it should work for you: Try It!

So I’ve managed to kind of do a workaround (it’s not quite what I wanted, but it might be the best I can do?)

I’m coding the error message saying that they have to press the table “submit” button at least once before it will accept an answer this way they have to at least check the table. I also coded the submit button reset to say the error message if the correct values are not in the table.

It’s not exactly pretty, but I think it gets the point across? Though I still can’t figure out why the code saying the table values must be correct doesn’t seem to matter?

errorMessage: when ((ST1.pressCount<1) and not(Table1.script.checkf1 and Table1.script.checkf2 and Table1.script.checkf3 and Table1.script.checkf4)) “Go back and check your table set up.” otherwise “”

It should work if you change the first “and” to “or.” It seemed to work correctly when I tried it.

errorMessage: when ((ST1.pressCount<1) or not(Table1.script.checkf1 and Table1.script.checkf2 and Table1.script.checkf3 and Table1.script.checkf4)) “Go back and check your table set up.” otherwise “”

This is just a suggestion, but I’m not sure the action button is necessary. You have several checks built in already with the cellSuffix and the errorMessage, so the action button is kind of redundant. Of course, you know your students better than me, but maybe leaving out the action button will make it easier to code for you. :grin:

1 Like

That was it! Thank you!

Also, if you wanted to just clean up what you have, I’d have a “checkAll” variable in the table CL. Then, in your action button, you don’t need to check each one.

In table:
checkAll= checkf1 and checkf2 and checkf3 and checkf4

In button, change the not part to: