Import Option Lists

Import options with CSV file

Instead of manually creating options for list box, radio button and check box group fields, you can also import them using a CSV file. If you need a large number of options or use many fields of these types in your form, this can be a great help.

The CSV file format

  • The CSV file must not contain a header line.
  • Each option is a separate line.
  • Each option has a minimum of 2 and a maximum of 3 elements.
  • The elements are separated by a separator.
  • This separator must be the same throughout the file.
  • You can use either a comma or a semicolon as a separator.
  • There is no separator after the last element.
  • The elements must be in the following order: option value, option label, default.
  • The third element (default) always has the value 1 when appended.
  • The separator cannot be used within an element.
  • Option values should be kept simple and concise.
  • The elements must not contain quotation marks (single or double).

Examples of valid CSV files

Comma separated

value1,label1
value2,label2,1
value3,label3
value4,label4
value with spaces, label with spaces

Semicolon separated

value1;label3
value2;label2
value3;label3;1
value with spaces; label with blanks

The import process

Import options

Import options

  • First select the separator used.
  • Select the import file on your computer (import options).

The import starts automatically as soon as you have selected an import file.

Existing options will be overwritten

If options have already been created for the field, these will be overwritten by the import. Visforms first deletes any existing options.

Each new option to be imported is checked for validity. If an option in the CSV file contains invalid values, it will be skipped during the import.

All options are always imported, i.e. you must create a separate import file for each field.

Note: After a successful import, you must save the field so that the options are also saved in the database.

You can manually edit all imported options as usual. After a successful import, further options can be created manually.

Known issue

Limitations of the HTML5 File API

The import is done with JavaScript and using the HTML5 File API. This is convenient because you only have to select the file. Everything else is done automatically directly by the browser. However, this procedure has some limitations that you must be aware of.

Use a modern browser

You need a modern browser that implements the HTML5 File API. If your browser does not support the file API, you will receive a corresponding error message. Please switch to a more modern browser, at least for the import. You can look up which browsers support the File API here: CanIUse.

Imported data cannot be saved

If you create a large number of options (for example more than 200) for a list box, it may happen that the options cannot be saved. When you click the “Save” button, the field only appears to be saved correctly. However, when you open the panel again, you will see that all the options have been lost. The problem occurs when the “php_value_max_input_vars” in the server configuration is set too low. If your provider allows you to set server settings in the .htaccess file, you can try to fix the problem. In the .htaccess file in the root of your web server, add this line:

php_value max_input_vars 4000

Or clarify directly with your provider how this setting can be increased.