Campo File

Sube archivos, como archivos de configuración o certificados


Propiedades

Las propiedades disponibles para un campo file, agrupadas por finalidad:

Atributo Comentarios
basic
name
string / obligatorio / único

Field name
Alfanumeric + underscore + dash

This attribute represents the name of the form field.

type
string / obligatorio

Field type

Other attributes might only be available for some field types.

Valor:
file
label
string

Field label
Free text

A friendly name/label for the field. Note: if not set, the field name is used as label, but not when type is html.

Since 6.0.3: Supports placeholders for dynamic labels (e.g., Label: $(fieldname)).

placeholder
string

In-field help value
Free text

Some form fields allow an in-field hint value.

Since 6.0.3: Supports placeholders for dynamic hints (e.g., Enter password (min $(minLength) chars)).

help
string

Field help message
Free text

Some fields require additional help information. This help message will be shown below the field.

Since 6.0.3: Supports placeholders for dynamic help text (e.g., This field depends on $(fieldname)).

data
interaction
dependencyFn
string
añadido en la versión 4.0.0

The dependency logical function

This attribute represents the logical function between multiple dependencies.

Opciones:
  • and (por defecto)
  • or
  • nand
  • nor
dependencies
list / elements=object

Show/hide this field based on the values or other fields
Reference to other formfields and their values

Each dependency element is either an object with the following 2 attributes:

  • name: holds the fieldname.
  • values: a list of valid values for the referenced field.

Or with the following 2 attributes:

  • name: holds the fieldname.
  • isValid: a boolean to check if the referenced is validated or not.

Use in combination with attribute dependencyFn.

output
output
boolean
añadido en la versión 6.2.0

Include field value as extravar

Form fields are by default sent as extravars.
Set to false to exclude a field from the extravar output.

Por defecto:
true
model
string or array

Extravar modelling
An dot-based string notation of an object, or an array of these

By default, a field is sent as a root-extravar.
If you want model the output of the extravars, you can specify a dot-notation of how this field should be modelled.

security
noLog
boolean
añadido en la versión 2.2.3

Disable backend logging

Disables logging in the backend, to hide passwords for example.

Por defecto:
false
validation
required
boolean

Required field

Makes the field required.

Por defecto:
false
minSize
number

File minimum size
Integer

Forces a file-fields size to not be lower than…

Since 6.0.3: Supports placeholders for dynamic validation (e.g., minSize: "$(minFileSize)").

maxSize
number

File maximum size
Integer

Forces a file-fields size to not be higher than…

Since 6.0.3: Supports placeholders for dynamic validation (e.g., maxSize: "$(maxUploadSize)").

accept
array

File types the picker offers
File extensions or MIME types

The file types the file picker offers, as extensions (.pdf) or MIME types (image/*).
It only filters the picker: a user can still choose another file. To refuse it, add a regex on the file name.

regex
object

A regular expression validation

Enforces a validation where the current field must match a regular expression. This field requires an object with 2 attributes:

  • expression: The regular expression
  • description: A validation message to show when the regex is not matched. (Since 6.0.3: Supports placeholders for dynamic messages)

ignoreIncomplete
boolean

Allow form submit on non-evaluated placeholders

When an expression-based field has placeholders,
the default form behaviour is not to allow form submit until all placeholders are resolved. When this attribute is true, the form does not wait for placeholder completion for this field.

Por defecto:
false
visualization
icon
string

Field icon
Free fontawesome 6 icon

Some formfields can hold a nice looking icon. The icon name is a free fontawesome 6 icon. You can find more information at www.fontawesome.com

group
string

The field group name
Free text

With this attribute you can group fields together.
When all fields in a group are hidden (due to dependencies), the group is also hidden.

line
string
añadido en la versión 4.0.3

The field line name
Free text

With this attribute you can group fields in a single line together.
Use together with the width parameter to set the width, if not, the width is auto.

width
string
añadido en la versión 4.0.3

The field width
A valid Bootstrap Column width

With this attribute you can set the width of a field.
Use together wit the line parameter to put fields on 1 line. see https://getbootstrap.com/

Opciones:
  • col-1
  • col-2
  • col-3
  • col-4
  • col-5
  • col-6
  • col-7
  • col-8
  • col-9
  • col-10
  • col-11
  • col-12

Ejemplos

Ejemplos de campos file, en YAML:

Software Image Upload

La definición del campo, en YAML:

- type: file
  name: software_image
  label: Upload software image