Steps to reproduce:

  1. Load the edit conditionals page (node//webform/conditionals).
  2. In a separate tab, edit a component, such as by adding a default value.
  3. Save the conditionals page (no need to make a change).

What should happen: The change made in step 2 is still there.

What happens: The change is reverted.

If you only ever have a form open in one tab and only one person at a time is editing the form, this problem will not happen.

This happens because the form submit handler calls node_save() on a node object loaded with the form, so it does not have the changes made in step 2. There are two other forms where the same general pattern exists.

Solution: Call node_load in the submit handler, make just the changes to it required by the form being submitted, and save that.

Risk: Other modules may edit $form['#node'] and expect those changes to be saved. Reloading will remove those changes.

Comments

Liam Morland created an issue. See original summary.

liam morland’s picture

Status: Active » Needs review
StatusFileSize
new2.29 KB

  • Liam Morland committed e68914d on 7.x-4.x
    Issue #3107170 by Liam Morland: Reload node before saving
    
liam morland’s picture

Issue summary: View changes
Status: Needs review » Fixed

I was concerned about possible side-effects with this change in webform_configure_form_submit() because the node_load() and node_save() are in different functions. Customization to submit handlers could trigger the risk described above. So the commit only changes the other two functions in which node_load() and node_save() are in the same function.

Status: Fixed » Closed (fixed)

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