WeBWorK Main Forum

Pop up answers are evaluated out of order

Pop up answers are evaluated out of order

by Gustavo Felisberto-Valente -
Number of replies: 2

I wrote a problem that has 3 popups and 3 numeric answers, but they alternate. When I input the answers, WeBWorK treats them in different orders (in other words, they mismatch). For example, the answer entered for the first popup is graded as a numeric answer (or vice-versa). How to fix the grading order? See below the source.

DOCUMENT();

loadMacros(
"PGstandard.pl", # Standard macros for PG language
"MathObjects.pl",
"PGML.pl",
#"source.pl", # allows code to be displayed on certain sites.
"PGcourse.pl", # Customization file for the course
"parserPopUp.pl",
);

# Show which answers are correct and which ones are incorrect
$showPartialCorrectAnswers = 1;

# First popup menu
$popupstrength = PopUp(["Strength",
"weak",
"moderate",
"strong"],
"strong"); # Correct answer

# Second popup menu
$popupdirection = PopUp(["Direction",
"negative",
"positive"],
"negative"); # Correct answer

# Third popup menu
$popupconclusion = PopUp(["Conclusion",
"Reject the null at the .05 level.",
"Fail to reject the null at the .05 level."],
"Reject the null at the .05 level."); # Correct answer

BEGIN_PGML
Two variables, Variable [`X`] and Variable [`Y`], are the focus of a study. The
study involves 14 research participants. The sum of the cross products
([`Z_X • Z_Y`]) for the 14 cases is -11.62.
a. Calculate and interpret [`r`].

[`r=`][_]{-.89}
This is a [@ $popupstrength->menu() @]*, [@ $popupdirection->menu() @]* relationship.

b. Calculate and interpret [`r^2`].

[`r^2=`][_]{.79}

c. Assuming you were to test the significance of [`r`] at the .05 level of significance,
state an appropriate null hypothesis. What would you conclude?

Null hypothesis: [`r=`][_]{0}
[@ $popupconclusion->menu() @]*
END_PGML

ANS( $popupstrength->cmp() );

ANS( $popupdirection->cmp() );

ANS( $popupconclusion->cmp() );

ENDDOCUMENT();
The graded answer is attached.
Notice the mismatch between the 2nd and the 5th answers.
Attachment Capture.JPG
In reply to Gustavo Felisberto-Valente

Re: Pop up answers are evaluated out of order

by Andrew Parker -
You can simply use the usual PGML answer blank code with the PopUp objects as the {answer}:

BEGIN_PGML
Two variables, Variable [`X`] and Variable [`Y`], are the focus of a study. The
study involves 14 research participants. The sum of the cross products
([`Z_X • Z_Y`]) for the 14 cases is -11.62.
a. Calculate and interpret [`r`].

    [`r=`][_]{-.89}  
    This is a [_]{$popupstrength}, [_]{$popupdirection} relationship.

b. Calculate and interpret [`r^2`].

    [`r^2=`][_]{.79}

c. Assuming you were to test the significance of [`r`] at the .05 level of significance,
state an appropriate null hypothesis. What would you conclude?

    Null hypothesis: [`r=`][_]{0}  
    [_]{$popupconclusion}
END_PGML


In reply to Andrew Parker

Re: Pop up answers are evaluated out of order

by Gustavo Felisberto-Valente -

Well that was straightforward 😅 I don't know why I went all convoluted in there.

Thank you very much, it worked like a charm.