Skip to content

[6.x] Fix Opinion Scale max, example value and selected answer in the CP - #16046

Merged
duncanmcclean merged 1 commit into
6.xfrom
st-1897
Nov 26, 2026
Merged

duncanmcclean merged 1 commit into
6.xfrom
st-1897

Conversation

@duncanmcclean

Copy link
Copy Markdown
Member

This pull request fixes a few issues with the Opinion Scale form fieldtype.

  • Fixes issue where a max value of 11 was allowed, but rendered as 10.
    • This was happening because the max config option allowed 11, but normalizedRange() capped it at 10.
    • I've fixed it by limiting the max config option to 10.
  • Fixes issue where the example value could be out of range.
    • This was happening because example() always returned 8, even though the example's own range was 0–5. Webhook example payloads would also use 8, regardless of the field's range.
    • I've fixed it by deriving the example value from the field's range (or the example's range in the builder).
  • Fixes issue where submitted answers weren't selected when viewing a submission in the CP.
    • This was happening because the front end stores the answer as a string ("4"), while the Vue component compared it strictly against integers.
    • I've fixed it by casting the value to a number before comparing, like the StarRating fieldtype does.

Before

Before

After

After


Amp thread: https://ampcode.com/threads/T-01a21255-5ea3-724f-b33d-2535d45c36ab

@duncanmcclean
duncanmcclean merged commit c22782b into 6.x Nov 26, 2026
65 checks passed
@duncanmcclean
duncanmcclean deleted the st-1897 branch November 26, 2026 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants