- Issue created by @andrew.wang
- 🇺🇸United States jrockowitz Brooklyn, NY
The "You have unsaved changes" is triggered by the drag-n-drop JavaScript. It will be challenging to trigger that behavior via the checkboxes.
@see https://git.drupalcode.org/project/drupal/-/blob/11.x/core/misc/tabledra...
We can leave this open for a few months to see if anyone is interested in working on this enhancement.
- 🇺🇸United States jrockowitz Brooklyn, NY
Wow, I don't know enough JS to fully understand tabledrag.js, but I was able to use PHPStorm's AI to generate the code snippet below, which displays the changed warning.
const table = document.getElementById('edit-webform-ui-elements'); // Replace `my-table` with the table ID. const row = table.querySelector('tr.draggable'); // Select a draggable row. const tableDrag = Drupal.tableDrag[table.id]; // Get the corresponding Drupal.tableDrag instance. const rowObject = new tableDrag.row(row, 'mouse', tableDrag.indentEnabled, tableDrag.maxDepth, true); // Mark the row as changed and trigger the changed warning. rowObject.markChanged(); rowObject.addChangedWarning(); <code> The next trick is to tweak and integrate this code in <code>webform.admin.tabledrag.js
- Merge request !677Issue #3538258 by jrockowitz, andrew.wang: "You have unsaved changes." prompt... → (Merged) created by jrockowitz
- 🇮🇳India divya.sejekan
Tested with MR!677 , The patch gets applied properly and the issue looks resolved
Observations :
1. '* You have unsaved changes.' message is displayed when checked or unchecked require checkbox.
2. Previous functionality like message on change of field arrangement is working as expected.RTBC++
-
jrockowitz →
committed dde5dc07 on 6.3.x
Issue #3538258 by jrockowitz, andrew.wang: "You have unsaved changes."...
-
jrockowitz →
committed dde5dc07 on 6.3.x
-
jrockowitz →
committed dde5dc07 on 6.x
Issue #3538258 by jrockowitz, andrew.wang: "You have unsaved changes."...
-
jrockowitz →
committed dde5dc07 on 6.x