CASE: create dropdown with select options

If you want to create a dropdown with select options, like this:
06

you’ll have to use the select-tag:

{% input period.custom.vat.imported as:select options:"Yes|No" %} 

However, you might wanna make sure the select-options present themselves in the right language. In order to do so, we’ll need to put those select-options within a translation-tag, and capture that into a new variable we’ll use for the select-tag:

{% t= "Yes|No" nl:"Ja|Neen" fr:"Qui|Non" %}

{% capture vat_options %}{% t "Yes|No" %}{% endcapture %}

{% t "Has the XML file been imported yet?" %}
{% input period.custom.vat.imported as:select options:vat_options %} 

But now the value of the object period.custom.vat.imported can have different values. If I want to built some logic around this object, where I want to display some text when “Yes” is selected, I have to take each possibility into consideration:

{% if period.custom.vat.imported == "Yes" or period.custom.vat.imported == "Ja" or period.custom.vat.imported == "Qui"  %}
The XML-import was done on {% input period.custom.vat.xml_import_date as:date %}. 
{% endif %} 

which is a lot of code of course. Luckily, you can give a value for each select option no matter what language you’re in, by adding the option_values-tag:

{% input period.custom.vat.imported as:select options:vat_options option_values:"Y|N" %} 

Your if-statement can be modified into this:

{% if period.custom.vat.imported == "Y" %}
The XML-import was done on {% input period.custom.vat.xml_import_date as:date %}. 
{% endif %}

by adding that tag, the values of the object become Y or N.

I’m having trouble making a dropdown in a account template
the dropdown should be in a forloop.

forloop as follows:
{% fori aandelen in company.custom.aandelen %}

dropdown
| {% input aandelen.aard as:select options: “Aankopen aandelen|Verkopen aandelen”%}

When testing the options Aankopen aandelen, verkopen aandelen doesn’t drop down.

Hi Alexander,

after “options:” you put a space that shouldn’t be there. If you remove it, the dropdown function works fine.

best regards,

Michiel