Main title validation not working on AJAX detach leading to data loss

Created on 19 May 2022, almost 3 years ago
Updated 12 December 2024, 4 months ago

Problem/Motivation

Basically return event.preventDefault(); when event is not set at all (called from detach behavior in editor module application.js)

Steps to reproduce

Submit h5p form with empty main title using AJAX.

Proposed resolution

See the attached patch.

Remaining tasks

This is more a workaround or a quick fix to prevent data loss, this should be addressed properly at some point. I found this that could help:
https://drupal.stackexchange.com/questions/271808/how-to-prevent-an-ajax...

πŸ› Bug report
Status

Needs work

Version

2.0

Component

Code

Created by

πŸ‡΅πŸ‡±Poland Graber

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States sim_1

    This 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.

  • πŸ‡ΊπŸ‡ΈUnited States sim_1

    Is 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?

Production build 0.71.5 2024