Import Option lists
Instead of creating the options of selects, radio buttons and checkbox groups manually, one at a time, you can also import them from a csv file. Especially if you want to create fields with many options, this may spare you time.
The CSV file
- The CSV file must not contain a header line
- Put each option in a new line
- Each option has a minimum of two and a maximum of three items
- The items are separated by the separator
- You must use the same separator throughout one csv file
- The separator can either be a comma or a semicolon
- There is no separator behind the last item in a line
- The items are (in this order): Option value, Option label, Default
- Default has always the value 1
- You can not have more than one option with an item "default"
- You must not use the separator inside an item
- You must not use Quotes (single or double) in items
Examples of valid csv files
Comma separated
wert1,label1
wert2,label2,1
wert3,label3
wert4,label4
wert mit leerzeichen, label mit leerzeichen
Semicolon separated
wert1;label3wert2;label2
wert3;label3;1
wert mit leerzeichen; label mit leerzeichen
The Import
- Choose the separator first
- Choose the import file on your computer (Import Options)
The import will start automatically after you have chosen the csv file. If you have already added options to your field, these options will be overriden by the import. Visforms will delete any existing option as a first step of the import. Each option, imported from the csv file, is validated first and only valid options are imported. Please don't forget to save the field after the import is completed in order to store the options in the database. You can change imported options manually and you can add more options manually after the import is completed.
Known problems
The import uses Javascriptand the HTML5 File-Api. This is convinient but has some restrictions.
Therefore you need a browser which supports the HTML5 file api
If your browser does not support the file api you will receibe an error message. Please check on caniuse which browser supports the file api and use a compatible browser.
Options are lost when the field is saved
If you have created a list box with many options (above 200) you may have difficulties saving the field. If click the "save" button, it looks as if the field is saved correctly, but when you open the field again, you can see, that the options are all lost. This problem is caused by the server setting "php_value_max_input_vars" which has a value which is to low. If your provider allows you to modify server setting in a .htaccess file you can try to fix the problem by adding a line
php_value max_input_vars 4000
to the .htaccess file in the root directory of your website. Otherwise you have to ask your provider on how to increase the value.