Code to check if an auto-checked component is correct?

Is there easy cl code that I can use to determine if a multiple choice/multiple select (or other auto-checked component) is correct?

For example, say I have MC1 a MC question, and then I want a feedback note to be hidden/unhidden depending on whether MC1 is correct. I know I can set up when/otherwise type statement that checks and compares the selection of the MC component, but that’s tedious and feels redundant. What I’d really like is to be able to do something like:

hidden: MC1.correct and MC1.submitted

Does that make sense? Is this possible? (And if not, consider this a feature request, lol. :grin:)

I thought there used to be a matchesKey or something for multiple choice, but it looks like it’s gone. The dashboard shows a check when it’s correct, so seems like it should have an easy CL. For multiple choice, you’ll just have to use MC1.isSelected(2) instead of correct. For checkboxes, you have to identify both what should and shouldn’t be selected.

correct =  MC1.isSelected(2) and MC1.isSelected(3) 
and not(MC1.isSelected(1) or MC1.isSelected(4))
1 Like

Thanks @Daniel_Grubbs! Yes, I know how to do it this way, where I have to set up a check for correctness. I was hoping there was something that streamlined that, since the component is already being checked for correctness automatically, it would be nice to have a one-stop-code that sounds basically like this “matchesKey” that you refer to. Especially since I frequently duplicate screens and tweak things, and doing it this longer way means that I have to “fix” this in the CL every time, too. I’m hoping there is a way to avoid that.

It seems redundant to have to code a correct-check for something that is already being correct-checked! :thinking: lol

2 Likes