zikula / DynamicFormBundle

Symfony bundle with helpers for handling dynamic form fields.
MIT License
1 stars 0 forks source link

ChoiceType DataTransformer #3

Closed craigh closed 2 years ago

craigh commented 2 years ago

Probably should store the data as the actual value? Or perhaps a configurable item to store value or label?

This also applies to ChoiceType with Other

see \Zikula\Bundle\DynamicFormPropertyBundle\Form\DataTransformer\ChoiceValuesTransformer also

craigh commented 2 years ago

This is different than the existing ChoiceValuesTransformer which is used when creating/editing the dynamic formtype

In the end, all choice types (and maybe other types) have to store the data/response. The site admin should decide what to store. Maybe a select box to store the response as

  1. value
  2. label
  3. value:label

Then the transformer needs to store the value correctly. If label is selected, the reverse transformer needs to locate the correct value then.

craigh commented 2 years ago

closing.

If an admin uses values only, then it stores that. If they make labels and values, then the values are stored. The admin will need to compensate in their display if they need the labels.