formio

Howto add default parameters to component in the form.io editor


I would like to add a default file location to the file upload control so that when someone drops a new file upload control onto their form, the values are already populated.

Is that possible ?


Solution

  • I found that I was able to add the file component to a custom section in the editor, and specify default storage and file location at that point... i.e.

    var builder = Formio.builder(document.getElementById('builder'), {}, {
                builder: {
                    custom: {
                      title: 'Extra',
                      weight: 20,
                      components: {
                        file: {
                          title: 'file',
                          key: 'file',
                          icon: 'file',
                          schema: {
                            label: 'Upload',
                            type: 'file',
                            key: 'file',
                            input: true,
                            storage: 'url',
                            url: 'https:yourfilelocation'
                          }
                        }
                      }
                    }
                  }
                })