Problem/Motivation

The bug. massageFormValues reads the order from the JS-maintained entity_ids hidden field, but when Drupal's AJAX button fires it doesn't trigger the form submit event — only the mouseup handler runs. More importantly, Drupal's core tableDrag always updates the weight number inputs when rows are dragged, and massageFormValues completely ignores those. The weight inputs are the authoritative source for order.

Proposed resolution

The fix adds a sort step: after decoding the entity IDs from the hidden field (which still handles add/remove correctly), it re-sorts them by the submitted weight values from items_table. The weight inputs are #type => 'number' elements submitted with every form POST, so they're always authoritative for drag order.

Comments

zeeshan_khan created an issue. See original summary.

zeeshan_khan’s picture

zeeshan_khan’s picture

Status: Needs review » Reviewed & tested by the community
zeeshan_khan’s picture

Status: Reviewed & tested by the community » Fixed

Fixed in 1.0.5

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.