Make toggle boxes equal a number and be used in a formula

I am working on creating a grading snippet for a 3 part assignment my students turn in. Part 1 is worth 20 points, and I want the value to be automatically calculated when I click the toggle boxes. So when I click the formtoggle B, It gives the written feedback to the student and also takes 5 points off the total for the section. The problem is also need the value of Part 1 to be added to the values of parts to create a total score. I can't get it to work right, and this would save me a ton of time grading if I could get this to work. We are not allowed to use data blaze, so that can not be part of the solution.

My textblaze for the specific part I am working on:

Part 1 - {formtext: name=Part1} {=20-{=bb}} / 20

{formtoggle: name=B}{note} {formtext: name=bb}{if:{=B}="yes"}{bb=5}{elseif:{=b}="no"}{bb=0}{endif}{endnote}
B- Newton's first law is about force changing the motion of an object. How does the interactive show this law? {endformtoggle}

Part 2- {formtext: name=Part2}

Part 3-{formtext: name=Part2}

TOTAL = {=Part1+Part2+Part3} / 60

Hi @Christiana_Swanson_M ,
Glad to see you back.
Here is a snippet you can use.
Please let me know if this works.

Part 1: {Part1=max(20 - penalty, 0)}{=Part1} pts
{note: preview=no}
{penalty= (5 if `Inertia Connection Missing` else 0)
+ (5 if `Force and Motion Change` else 0)
+ (5 if `Balanced vs Unbalanced Forces` else 0)
+ (5 if `Specific Examples Needed` else 0)
+ (5 if `Scientific Terminology Missing` else 0)
+ (5 if `Why Explanation Lacking` else 0)
}
{endnote}{formtoggle: name=Inertia Connection Missing; default=no}You identified inertia, but didn't explain how it relates to the interactive demonstration. Show the connection more clearly!{endformtoggle}

{formtoggle: name=Force and Motion Change; default=no}Newton's first law is about force changing the motion of an object. How does the interactive show this law? You need to specifically address force and motion change.{endformtoggle}

{formtoggle: name=Balanced vs Unbalanced Forces; default=no}You mentioned the object's behavior but didn't explain the role of balanced vs. unbalanced forces. This is crucial to understanding the first law!{endformtoggle}

{formtoggle: name=Specific Examples Needed; default=no}Your response lacks specific examples from the interactive. Reference particular moments or scenarios from the demonstration.{endformtoggle}

{formtoggle: name=Scientific Terminology Missing; default=no}The explanation needs more scientific terminology. Use terms like 'net force,' 'equilibrium,' and 'constant velocity' to strengthen your answer.{endformtoggle}

{formtoggle: name=Why Explanation Lacking; default=no}You described what happened but didn't explain WHY it demonstrates Newton's first law. Connect the observation to the underlying physics principle.{endformtoggle}

Part 2- {formtext: name=Part2; default=20} pts {if: not isnumber(Part2) or Part2 < 0 or Part2 > 20}{error: Should be between 0 and 20; block=yes}{endif}
Part 3- {formtext: name=Part3; default=20} pts {if: not isnumber(Part3) or Part3 < 0 or Part3 > 20}{error: Should be between 0 and 20; block=yes}{endif}

Total = {=(Part1 + Part2 + Part3)} / 60 pts

1 Like

That works wonderfully! Thank you!.

Now what if I made a Toggle box for if they are missing some questions or all of the questions. This is my current toggle box. I would like them to have a zero if I selected this section, and only lose 5 points for the other options.

{formtoggle: name=Part 1 Missing; default=no}
You are missing {formmenu: this section; A; B; C; D; multiple=yes; name=missingp1; formatter=items -> join(items, "BLAZE_AND"); }.{endformtoggle}

Something like this works?

Part 1: {Part1=max(20 - penalty, 0)}{=Part1} pts
{note: preview=no}
{penalty=20 if `Part 1 missing` else (
(5 if `Inertia Connection Missing` else 0)
+ (5 if `Force and Motion Change` else 0)
+ (5 if `Balanced vs Unbalanced Forces` else 0)
+ (5 if `Specific Examples Needed` else 0)
+ (5 if `Scientific Terminology Missing` else 0)
+ (5 if `Why Explanation Lacking` else 0)
)}
{endnote}{formtoggle: name=Part 1 missing; default=no}{if: not `Part 1 missing`}

{formtoggle: name=Inertia Connection Missing; default=no}You identified inertia, but didn't explain how it relates to the interactive demonstration. Show the connection more clearly!{endformtoggle}

{formtoggle: name=Force and Motion Change; default=no}Newton's first law is about force changing the motion of an object. How does the interactive show this law? You need to specifically address force and motion change.{endformtoggle}

{formtoggle: name=Balanced vs Unbalanced Forces; default=no}You mentioned the object's behavior but didn't explain the role of balanced vs. unbalanced forces. This is crucial to understanding the first law!{endformtoggle}

{formtoggle: name=Specific Examples Needed; default=no}Your response lacks specific examples from the interactive. Reference particular moments or scenarios from the demonstration.{endformtoggle}

{formtoggle: name=Scientific Terminology Missing; default=no}The explanation needs more scientific terminology. Use terms like 'net force,' 'equilibrium,' and 'constant velocity' to strengthen your answer.{endformtoggle}

{formtoggle: name=Why Explanation Lacking; default=no}You described what happened but didn't explain WHY it demonstrates Newton's first law. Connect the observation to the underlying physics principle.{endformtoggle}{endif}

Part 2- {formtext: name=Part2; default=20} pts {if: not isnumber(Part2) or Part2 < 0 or Part2 > 20}{error: Should be between 0 and 20; block=yes}{endif}
Part 3- {formtext: name=Part3; default=20} pts {if: not isnumber(Part3) or Part3 < 0 or Part3 > 20}{error: Should be between 0 and 20; block=yes}{endif}

Total = {=(Part1 + Part2 + Part3)} / 60 pts

Or if you like to use dropdown

Part 1: {Part1=max(20 - penalty, 0)}{=Part1} pts
{note: preview=no}
{penalty=20 if `Part 1 missing` else count(`part 1 items`) * 5}
{endnote}{formtoggle: name=Part 1 missing; default=no}{if: not `Part 1 missing`}
You are missing {formmenu: You identified inertia, but didn't explain how it relates to the interactive demonstration. Show the connection more clearly!; Newton's first law is about force changing the motion of an object. How does the interactive show this law? You need to specifically address force and motion change.; You mentioned the object's behavior but didn't explain the role of balanced vs. unbalanced forces. This is crucial to understanding the first law!; Your response lacks specific examples from the interactive. Reference particular moments or scenarios from the demonstration.; The explanation needs more scientific terminology. Use terms like 'net force,' 'equilibrium,' and 'constant velocity' to strengthen your answer.; You described what happened but didn't explain WHY it demonstrates Newton's first law. Connect the observation to the underlying physics principle.; multiple=yes; formatter=items -> join(items, "BLAZE_AND"); name=Part 1 items; cols=50}.{endif}

Part 2- {formtext: name=Part2; default=20} pts {if: not isnumber(Part2) or Part2 < 0 or Part2 > 20}{error: Should be between 0 and 20; block=yes}{endif}
Part 3- {formtext: name=Part3; default=20} pts {if: not isnumber(Part3) or Part3 < 0 or Part3 > 20}{error: Should be between 0 and 20; block=yes}{endif}

Total = {=(Part1 + Part2 + Part3)} / 60 pts

That is exactly what I wanted! Thank you!

1 Like

Okay. I am trying to do that but instead of selecting sentences, I want to just select numbers. For example, I want to select the togglebox "AIP!" then I would prefer to have a drop down menu with the options : this section; #1;#2 instead of using toggle boxes. Is there a way to do that and still have it subtract preset points? I would like to do the same thing for the toggle box "MIssingP1" and "simplify". My snippets are getting overly complicated, and it makes it lot harder to make changes without screwing up my current snippet.

Pre-Lab - {Part1=max(10 - penalty, 0)}{=Part1} /10pts {note: preview=no}
{penalty=(10 if `aiP1all` else 0)

  • (2.5 if `aiP1A` else 0)
  • (2.5 if `aiP1B` else 0)
  • (5 if `aiP1C` else 0)
  • (10 if `mP1all` else 0)
  • (2.5 if `P1A` else 0)
  • (2.5 if `P1B` else 0)
  • (5 if `P1C` else 0)
  • (2.5 if `half#3` else 0)
  • (2 if `#1` else 0)
  • (2 if `#2` else 0)
  • (5 if `p#3` else 0)
    } {endnote}{formtoggle: name=AIP1; default=no}
    Please answer: {formtoggle: name=aiP1all} this section.{endformtoggle}{formtoggle: name=aiP1A; default=no}#1 {endformtoggle}{formtoggle: name=aiP1B; default=no} #2{endformtoggle}{formtoggle: name=aiP1C; default=no} #3{endformtoggle} in your own words. {endformtoggle}{formtoggle: name=simplify}

{formmenu: name=s#; 1; 2; multiple=yes; formatter=items -> join(items, "BLAZE_AND") } - You used overly complicated words and phrases in your responses. The goal of your answers should be to communicate ideas effectively, not to impress with complex language. Please revise your answer to provide a short and direct response..{endformtoggle}{formtoggle: name=MissingP1; default=no}

You are missing: {formtoggle: name=mP1all} this section.{endformtoggle}{formtoggle: name=P1A; default=no} #1{endformtoggle}{formtoggle: name=P1B; default=no} #2{endformtoggle}{formtoggle: name=P1C; default=no} #3{endformtoggle}{formtoggle: name=half#3} part of #3{endformtoggle}.{endformtoggle}{note}

{endnote}{formtoggle: name=#1; default=no}
#1 - What happens to the electrons in sodium (Na) and chlorine (Cl) when they create a bond? Review page 2 of the lesson to help you.{endformtoggle}{formtoggle: name=#2; default=no}
#2 - Chemical bonds are based the valance electrons How are the electrons different in a covalent bond from an ionic bond?{endformtoggle}{formtoggle: name=p#3 ; default=no}
#3 - Review the tab "Properties of Ionic Compounds" at the bottom of page 2 and the tab "Properties of Covalent Compounds" at the bottom of page 3.Then try this question again. {formtext: name=ionic-high,high, low, high}{endformtoggle}

Hi @Christiana_Swanson_M ,
I can definitely build a snippet that does that. Could you explain how the scoring should work for each choice so I can match your grading exactly?