Closed (fixed)
Project:
H5P - Create and Share Rich Content and Applications
Version:
2.0.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
19 May 2022 at 13:20 UTC
Updated:
1 Oct 2025 at 21:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
graber commentedComment #3
graber commentedComment #4
alexrayu commentedConfirmed. This patch successfully substitutes a title.
Comment #5
sim_1This works to substitute a title, but I still end up in a bad state. The form validation works when creating the H5P is in a unique form, but when it's within a multi-value field it fails. For example, we have it as a media item that can be added in a multi-value field and that submit/save button (for the field) isn't recognized in the same was as the whole entity submit button.
Comment #6
sim_1Is there a better way to detect what type of form (single value field form within a node vs media vs multivalue field etc) it is and therefore intercept the form validation more universally there?
Comment #7
maya maierDo you have repro steps/configuration for this issue? I'm unclear on the context where this would be submitted through AJAX.
Comment #8
sim_1Yes, this particularly happens when H5Ps are being added within a multi-value field. This means that the field to add an h5p exists within a node/entity form. The node validation and the h5p form validation aren't speaking well to each other.
Comment #11
msandoval commentedI've applied changes to the submit handler to account for use in multi-value fields. Ready for review.
Comment #12
illeace commentedWith this fix, we've somewhat redefined the issue being fixed, which is that any unsaved H5P edits are lost when adding or removing an H5P field in the multi-H5P field scenario. This patch largely fixes that and is a meaningful enough improvement that I'm marking it RTBC, despite the fact that there is still a fair amount of jank in the validation of H5P items, especially in a multi-field environment. Some examples of remaining issues:
I think the interaction between Drupal form validation and H5P item/field validation needs a bit of a refactor. I will create a new issue along those lines and include this detail in that issue.
Comment #13
sim_1I think the original issue I was concerned with was #3216239: Can't save host entity after adding more while using H5P Editor when missing required fields. I wasn't aware of this other one. I will merge this issue, but I guess it's important to note for others looking for a fix, that my comments above apply to that other issue, not the one that was solved here.
Comment #15
sim_1Merged and marking as fixed. Thank you, everyone!