Pimcore_select defaultValue

Hello there,
the documentation on pimcore_select’s defaultValue is irritating.

In the twig example there is the option of defaultValue, however I don’t see that option being processed any where in Pimcore\Model\Document\Tag\Select. The documentation shows also a different way to preselect an item in the select tag.

How do I set a defaultValue for the Select tag?
Should I create my own version of the Select tag?

Hey @khusseini,

defaultValue option works for twig templates too and replaced the pre-select workaround on latest documentation. You should be able to set default value for select fields on document editor however document needs to be saved for the values to be stored on db and published to document.

It sets the value on client side https://github.com/pimcore/pimcore/blob/675533aa84da36de5e170a0ec625da9c71c796b7/bundles/AdminBundle/Resources/public/js/pimcore/document/tags/select.js#L35-L37


1 Like