Disable the action button

I have an activity in which the students enter two equations in a table that will auto graph. I would like to make an action button that will not graph the equations until the students have entered both of them fully. What is the code to “disable” the action button for this? I don’t understand the Boolean code after “disable”.

Thank you!!

Are you expecting them to “submit” their equations? Are they in two separate math inputs?

If so, you can use code like:

disabled: not(math1.submitted and math2.submitted)

(replacing “math1/2” with the actual names of those inputs).

If they’re not hitting a submit button then maybe something like:

disabled: not(isBlank(math1.latex) or isBlank(math2.latex))

might work, although I’ve not tested this.

I am expecting them to submit their equations to check for correct response but then I have an action button to graph from a table. It’s the action button that I would like disabled until they check their answers for correctness. Here’s my code for the table:

#Correct response 3x+3y=15 or 4x+3y=18

#creates lhs-rhs, so f(x,y)= 3x+3y-15 and g(x,y)=4x+3y-18
f = parseEquation(this.cellContent(1,1)).differenceFunction(“x”,“y”)
g = parseEquation(this.cellContent(1,2)).differenceFunction(“x”,“y”)

#solutions should = 0
checkA = f.evaluateAt(5,0)=0 and f.evaluateAt(0,5)=0
checkB = f.evaluateAt(4.5,0)=0 and f.evaluateAt(0,6)=0
checkC = g.evaluateAt(5,0)=0 and g.evaluateAt(0,5)=0
checkD = g.evaluateAt(4.5,0)=0 and g.evaluateAt(0,6)=0

correct: (checkA and checkD) or (checkB and checkC)

isCorrect1 = checkA or checkB
isCorrect2 = when checkA checkD when checkB checkC otherwise false

submitButtonText: “Check my Answers”

count = this.submitCount

cellSuffix(1,1): when this.submitted (when isCorrect1 and count > 0 “:white_check_mark:” otherwise “:x:”) otherwise “”
cellSuffix(1,2): when this.submitted (when isCorrect2 and count > 0 “:white_check_mark:” otherwise “:x:”) otherwise “”

Tables don’t have a Submit button so neither submitButtonText or submitCount will work on that. Where are you anticipating that “Check my answers” will show?

Can you share the actual activity so we have a better idea of what you have in place?

Do you want the answers to BE correct before they are graphed or you only want the students to CHECK for correctness?

Here is a version of what you need, I think. The only difference is that students will get the green checkmark if correct or nothing if not correct.

You have two versions of the action button that will graph the equations – one works only if the right answers have been entered, the other one if the answers have been checked (but are not necessarily correct). Delete the button you do not need.

P.S. I have not included the graph itself.