I am trying to use a Dynamic Dropdown field in a Guest Entries form (https://github.com/craftcms/guest-entries) but the default values are always saved on the new entry.
I've tracked it down to this part of Dropdown::normalizeValue():
if ($this->isFresh($element) ) :
foreach ($options as $key => $option) :
if (!empty($option['default'])) :
$value = $option['value'];
endif;
endforeach;
endif;
isFresh() is evaluating to true, because on the front-end there hasn't been a draft/revision created (unlike how Craft 3.2+? behaves). And because it evaluates to true, it sets the value to the default, overriding what value was passed to it.
I'd be happy to submit a pull request if you think this is correct?!
I am trying to use a Dynamic Dropdown field in a Guest Entries form (https://github.com/craftcms/guest-entries) but the default values are always saved on the new entry.
I've tracked it down to this part of
Dropdown::normalizeValue()
:isFresh()
is evaluating to true, because on the front-end there hasn't been a draft/revision created (unlike how Craft 3.2+? behaves). And because it evaluates to true, it sets the value to the default, overriding what value was passed to it.I'd be happy to submit a pull request if you think this is correct?!