Component to prefill all answers in activity

Imagine one or more of the following:

  1. You have a really long activity that you’d like feedback on.
  2. You have a reasonably size activity with really long answers. You’d still like feedback and want to make it easier for folks to work through it.
  3. You are building the activity and don’t want to keep typing in answers in a long activity or long answers in a short activity.

Consider the following example with an annoying answer.

<setup>
  <boolean name="fastMode">false</boolean>
</setup>

Enter <m>x(x+1)^2(x+2)^3(x+3)^4(x+4)^5</m>.

<conditionalContent>
  <case condition="$fastMode">
    <answer name="ans1" symbolicEquality>
      <mathInput name="userInput" prefill="x (x+1)^2 (x+2)^3 (x+3)^4 (x+4)^5"/>
      <award>
        <when>$userInput=x (x+1)^2 (x+2)^3 (x+3)^4 (x+4)^5</when>
      </award>
    </answer>
  </case>
  <case condition="not $fastMode">
    <answer name="ans1" symbolicEquality><mathInput name="userInput"/>
      <award>
        <when>$userInput=x (x+1)^2 (x+2)^3 (x+3)^4 (x+4)^5</when>
      </award>
    </answer>
  </case>
</conditionalContent>

When <fastMode>(name might need to be workshopped) is false, you see what students would expect to see.

Screenshot 2026-07-01 at 7.47.58 PM

When <fastMode>is true, you see a math input box with the answer prefilled.

Screenshot 2026-07-01 at 7.49.28 PM

When an assignment is created, <fastMode>is either ignored, forced to be false or removed from the the assignment entirely.

<setup>
  <fastMode>true</fastMode>
</setup>

Enter <m>x(x+1)^2(x+2)^3(x+3)^4(x+4)^5</m>.

<answer name="ans1" symbolicEquality>
  <mathInput name="userInput" />
  <award><when>$userInput=x (x+1)^2 (x+2)^3 (x+3)^4 (x+4)^5</when></award>
</answer>

The above could create a prefill for the math input box and display it. Or maybe the prefill needs to be there at all times but it only gets shown for the entire activity when <fastMode> is true.

1 Like

This would make it easier to check activities as you add (or subtract) elements and features.

This is certainly an interesting idea, but I don’t yet understand it well enough to evaluate how it could be accomplished. As it would presumably be a big endeavor to accomplished, I’d want to make sure this is something that would be useful to many people.

My sense, though, is that this would not be something you author in DoenetML itself. It feels to me more like a flag that the application gives to Doenet with the instructions: “fill inputs with the correct answers as much as possible.” When Doenet gets that flag, it finds instances of <award>correct answer</answer> and prefills the associated input with correct answer. It will be harder to determine what to do with <award><when>, but if it is <award><when>$thisInput = correct answer</when></award>, then the correct result would be to prefill the input with name $thisInput with correct answer.

There would be plenty of cases where Doenet couldn’t determine the correct answer, but we could at least address the easy cases. One could imagine adding an attribute to an input fillMeWithThisWhenYouArePrefillingCorrectAnswers="correct answer", and that property with override any default algorithm of determining what to prefill.

Then, we would have some setting in the Doenet website where you could, while editing the document, turn on this flag, which would cause the prefills to be initiated.

I’d want to workshop this around and see what would me most useful to people.