Skip to content

Fixing issue where custom default value without a 'value=' within the script would return an empty string.#6049

Merged
brendanbond merged 3 commits intomasterfrom
fix-eval-values
Jun 12, 2025
Merged

Fixing issue where custom default value without a 'value=' within the script would return an empty string.#6049
brendanbond merged 3 commits intomasterfrom
fix-eval-values

Conversation

@travist
Copy link
Copy Markdown
Member

@travist travist commented Mar 13, 2025

Link to Jira Ticket

https://formio.atlassian.net/browse/FIO-XXXX

Description

There was a bug that I fixed in the previous pr ( #6048 ) that was attempting to protect the case where no "value=" is provided within the customDefaultValue as well as the calculatedValue evaluations. Previously, this would return an empty string, which would then set the defaultValue to an empty string causing major problems for incompatible datatypes.

This PR reverts the "fix" from the previous PR and implements a better change which is to default the value passed to the evaluation context with the current dataValue of the component, which is what it should be. This way, if the user does not provide a "value=" within the evaluation, then it will return the current dataValue.

Breaking Changes / Backwards Compatibility

This may break any implementations that previously expected an empty string return as the result of customDefaultValue.

Dependencies

None

How has this PR been tested?

Manual testing

Checklist:

  • I have completed the above PR template
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • My changes include tests that prove my fix is effective (or that my feature works as intended)
  • New and existing unit/integration tests pass locally with my changes
  • Any dependent changes have corresponding PRs that are listed above

@brendanbond brendanbond merged commit 6520706 into master Jun 12, 2025
15 of 18 checks passed
@brendanbond brendanbond deleted the fix-eval-values branch June 12, 2025 15:33
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