Support "0" values without needing to specify a default value.

Created on 30 July 2024, 5 months ago
Updated 17 September 2024, 3 months ago

Problem/Motivation

Sometimes, 0 is a valid value, but it's currently ignored, and can lead to crashes when a webform is submitted.

This is because \Drupal\calculation_fields\CalculationFieldsTrait::buildExpression() can sometimes return NULL when the value is empty.

Steps to reproduce

Attempt to submit a form with a markup element with a 0 value.

Proposed resolution

Add appropriate checks for NULL values.

I'm unsure if a NULL value should be flagged as a validation error or not in the validate function. But I've replicated what the FormCalculationElement currently does.

Remaining tasks

Provide issue fork.

📌 Task
Status

Closed: cannot reproduce

Version

1.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024