Skip to content
Snippets Groups Projects
Commit 1bcd323e authored by Klaas Eikelboom's avatar Klaas Eikelboom
Browse files

Fix for #3449578: Default values overwrite updated values.

parent 7a577528
No related branches found
No related tags found
1 merge request!24Fix for #3449578: Default values overwrite updated values.
......@@ -115,7 +115,12 @@ class WebformSubmissionHandler {
* This method performs alterations on the form array.
*/
public function alterForm(array &$form, FormStateInterface $form_state, WebformSubmissionInterface $webform_submission) {
if (!$form_state->isSubmitted()) {
if (empty($form_state->getUserInput())) {
// If a form has no user input it is rendered for the first time
// then possible default values are retrieved from civicrm to
// change this form from an insert to an update form.
// Does the form have user import (because it is validating for example)
// no default values must be retrieved because they would overwrite the user input
$values = $this->formProcessorDefaultsDefault();
if (!empty($values) && empty($values['is_error'])) {
unset($values['is_error']);
......@@ -711,7 +716,7 @@ class WebformSubmissionHandler {
* Filter the triggers. The triggers are defined by the key and a value
* whether those are checked (1) or not checked (0).
* This function returns the keys fo the array when the value is 1
*
*
* @param $trigger
*
* @return array
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment