Dynamically populate selection fields
Up to Table of ContentsThis FAQ applies to: Any version.
Yes, just use the [overrides] panel of the field's edit view to set an Options Vocabulary.
It should be a TALES expression that evaluates as a list of value/label lists (tuples are also OK).
For example, let's say that we wanted a selection field populated with option values '1', '2', '3', '4' and matching visible labels 'one', 'two', three', 'four'. The TALES code for this would be:
python: (('1','one'), ('2','two'), ('3','three'), ('4','four'))It's unlikely, though, that you'll be able to do what you need in a single line of TALES. So, a more typical use would be to create a python script that returns a sequence of value/label sequences. If you put that script in your form folder, you can just fill in:
here/myscriptid
in your Options Vocabulary field.