Skip to main content

Opinion ScaleProRevised in 5.0+

A special field that allows for flexible opinion scoring using Freeform's built in CSS. The field.type property value is opinion-scale (for conditionals). This field type is included automatically with the Pro edition of Freeform.

​Settings

  • Set the field's option values and optional corresponding labels.
  • Optionally add legends to correspond to with choice options (e.g. Less Satisfied, More Satisfied).

​Styling & Customization

To manually render an Opinion Scale field to use your own styles, your code might look something like this:

{% set field = form.get("opinionScale") %}

<ul style="border: 1px dashed gray; padding: 5px;">
{% for scale in field.scales %}
<li>
<input type="radio" name="{{ field.handle }}"
value="{{ scale.value }}"
id="{{ field.idAttribute }}-{{ loop.index }}"
{{ field.value == scale.value ? "checked" }}
class="hidden"
/>
<label for="{{ field.idAttribute }}-{{ loop.index }}">
{{ scale.label ?: scale.value }}
</label>
</li>
{% endfor %}
</ul>

{% if field.legends %}
<ul>
{% for legend in field.legends %}
<li>{{ legend }}</li>
{% endfor %}
</ul>
{% endif %}

​Templating

PropertyDescription
field.scalesThe configured scale options, including translated labels.
field.legendsThe configured legend objects, including translated labels.

​Resources