Skip to content
Snippets Groups Projects

Don't set a default value if the field already has a value

All threads resolved!
1 file
+ 4
0
Compare changes
  • Side-by-side
  • Inline
@@ -120,6 +120,10 @@ class WebformSubmissionHandler {
if (!empty($values) && empty($values['is_error'])) {
unset($values['is_error']);
foreach ($values as $field => $value) {
$existingValue = $webform_submission->getElementData($field);
if ($existingValue !== NULL && $existingValue !== '') {
continue;
}
$this->setDefaultValue($form, $form_state, $webform_submission, $field, $value);
}
}
Loading