Steps to reproduce:
- Load the edit conditionals page (node//webform/conditionals).
- In a separate tab, edit a component, such as by adding a default value.
- 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.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | webform-reload_before_save-3107170-2-D7.patch | 2.29 KB | liam morland |
Comments
Comment #2
liam morlandComment #4
liam morlandI 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.