Scoring Variables ($v)
Track and rank scores dynamically for quizzes and interactive forms.
Last updated
Was this helpful?
Track and rank scores dynamically for quizzes and interactive forms.
Last updated
Was this helpful?
The special $v
variable represents scoring variables in Superform, allowing you to track and calculate scores for quizzes and other interactive elements.
Track Scores: Use $v
to keep track of scores for different items or participants.
Calculate Scores: Update scores dynamically based on user actions.
Display Scores: Easily show current scores in real-time with .
Rank Scores: Automatically rank participants based on their scores with Score Ranking.
Learn More
For an in-depth explanation and advanced usage of quiz and scoring variables, check out the full Score Tracking sections.
Since Superform is built in vanilla JavaScript, you will see both HTML and Webflow examples, it's practically the same — works with Webflow's Custom Element and elements inside Code Embed.
Let's build a Ross vs Monica simple quiz. Who would win in a fight?
1. Initialize Scoring Variables: Declare the scoring variables within your form container to track points for ross
and monica
.
sf-score="ross, monica"
2. Score Your Answers: Use radio buttons (or any
input element) to allow selection between Monica and Ross, incrementing the score based on user choice.
sf-score-calc="method(expression, variable, value)"
(available methods: add
, minus
, multiply
, divide
)
sf-score-calc=add(checked, ross, 1)
sf-score-calc=add(checked, monica, 1)
Here we are adding each method to the respective radio button to assign points to each answer.
3. Displaying Results: Show any variable's points and which is the top choice with $v.variableName
, $v_rank[0]
and Reactivity.
Webflow Example
→ Explore $v._rank feature .