Ensure calculated values are set on initial load#97
Merged
Conversation
fed7465 to
2748cc0
Compare
jensschuppe
approved these changes
Aug 13, 2025
Contributor
jensschuppe
left a comment
There was a problem hiding this comment.
I guess calculating before rendering the form is not an option in order to not rely on an additional request …?
Collaborator
Author
|
It would be difficult to get the data before submit as it may consist of default values and values in temporary form state data. It would require to parse the JSON schema once to get the default values and a second to time to build the Drupal form. The implemented solution has also the benefit that the form can be cached without user interaction which especially makes sense when the form specification is generated by a remote system. Otherwise there might be additional delay on the first calculation request. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Calculated values might not be set on initial form load. By dispatching a
changeevent on a field that has the corresponding AJAX callback a calculation is triggered.systopia-reference: 29899