Feedback from choices

Good Morning,

I am having difficulty writing feedback for an MCQ for an activity I am working on. I am unable to display the right feedback for a selection that is incorrect, the same feedback is coming up with each answer. I have tried to name each choice and refer back to them, but that is not working.

Any help is much appreciated.

<section boxed><title>Check Your Understanding</title>
<graph grid="1 1" fixed size="small">
  <function>1/2(x-3)^2-4</function>
</graph>

<exercise>

  

The graph of <m>g(x)</m> shown above is the transformation of the parent function <m>f(x)=x^2</m>. Which
equation correctly describes <m>g(x)</m>?
  <answer name="ans" creditByAttempt="1 0.7 0.5" shuffleOrder maxNumAttempts="3"><shortDescription>MCQ</shortDescription>
      <choice name="a"><m>g(x)=2(x+3)^2-4</m></choice>
      <choice credit="1"><m>g(x)=\frac12(x-3)^2-4</m></choice>
      <choice name="c"><m>g(x)=\frac{1}{2}(x+3)^4-4</m></choice>
      <choice name="d"><m>g(x)=\left(\frac{1}{2}x-3\right)^2-4</m></choice>
    </answer>

     <feedback condition="$ans != $c and $ans.responseHasBeenSubmitted">
  Check your horizontal Shift 
    </feedback>
    <feedback condition="ans ! = $d  and $ans.responseHasBeenSubmitted">
        The dilation should be vertical, not horizontal. </feedback>
    <feedback condition="$ans ! =$a and $ans.responseHasBeenSubmitted">
      <p>Check your horizontal shift. You should be moving right 3 units, not left. Also, please check your vertical dilation which should be a vertical shrink, not stretch. </p>
    </feedback>
</exercise> 

For a <choice name="c">, we don’t have a good way to compare its contents, since it could be anything. Now, seeing your example, it would make sense to be able to interpret $ans = $c, but we’ve made some choices that hard to implement.

Instead, we interpret a bare reference $c to be a shortcut to $c.submitted, i.e., it is a boolean that is true if the latest answer submission’s submitted response included choice c. The idea was to make <feedback condition="$c"> just work, but I see now that might be confusing. Maybe it is easier to understand if you write it as <feedback condition="$c.submitted">.

If you want something to show if a choice isn’t submitted, then you’ll still need

<feedback condition="$!c.submitted and $ans.responseHasBeenSubmitted">

so that it doesn’t start off showing that feedback.

Note: adding updateWith="$ans" as an attribute to the <feedback> can also be helpful. Then it only updates when the answer is submitted, and you won’t need the responseHasBeenSubmitted.

Note 2: You missed a $ on ans in one of your conditions.