Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/Form/Control/Util/BasicFormPropertiesFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,13 @@ public static function createFieldProperties(ControlDefinition $definition, Form
if ($definition->isCalculated()) {
$formState->set('$calculateUsed', TRUE);
}
elseif (TRUE !== $formState->get('$hasCalcInitField') && 'hidden' !== $definition->getOptionsValue('type')) {
elseif (TRUE !== $formState->get('$hasCalcInitField')
// Change event cannot be triggered on hidden fields.
&& 'hidden' !== $definition->getOptionsValue('type')
// A field of type managed_field might be used which is rendered in a way
// that it cannot be used as field for initial calculation.
&& 'file' !== $definition->getControlFormat()
) {
$formState->set('$hasCalcInitField', TRUE);
$calcInitField = TRUE;
}
Expand Down Expand Up @@ -126,7 +132,7 @@ public static function createFieldProperties(ControlDefinition $definition, Form

if ((!$form['#disabled'] && TRUE === $formState->get('recalculateOnChange')) || $calcInitField) {
$form['#ajax'] = [
'callback' => RecalculateCallback::class . '::onChange',
'callback' => [RecalculateCallback::class, 'onChange'],
'event' => 'change',
'progress' => [],
'disable-refocus' => TRUE,
Expand Down