WTF is expression ? π§
Learn what a JavaScript expression is β push Superform to it's limits.
The sf-react
attribute uses an expression to determine what text to display or what class and/or visibility to toggle dynamically.
This expression can be a simple JavaScript snippet that may include special variables ($f
, $v
, $s
, $p
) provided by Superform, but itβs not limited to them.
What is an Expression?
Simple JavaScript Snippet: The expression is essentially a small piece of JavaScript code that is evaluated to produce the text content. It can be as simple as referencing a form variable or as complex as a combination of them with standard JavaScript operations.
Form Variables: You can include variables like
$f
(form inputs),$v
(scoring variables),$s
(step index), and$p
(progress percentage) within your expression to dynamically display data from your form.Without Variables: The expression can also be a static string or a JavaScript operation that doesn't directly reference form data, providing flexibility in content display.
Example expressions
1. Simple expression containing a Form Field
Last updated