Skip to main content

Other fields

Select a date

The DateField enables a user to select a date on a calendar.

from viktor.parametrization import ViktorParametrization, DateFieldclass Parametrization(ViktorParametrization):    date = DateField('Pick a date')

The value is returned in the params as a datetime.date object.

Toggle button

Changed in v12.1.0

ToggleButton has been renamed to BooleanField.

The BooleanField acts as a toggle button which can be either True or False:

from viktor.parametrization import ViktorParametrization, BooleanFieldclass Parametrization(ViktorParametrization):    is_true = BooleanField('False / True')

Generic JSON data

The purpose of the HiddenField is to store JSON-type data in the params, without showing this information to the user in the editor. For example, when doing upload file processing.

from viktor.parametrization import ViktorParametrization, HiddenFieldclass Parametrization(ViktorParametrization):    json_data = HiddenField('This is not visible')
caution

Use the HiddenField with moderation. Prefer to store specific type of data on its corresponding field (e.g. number on a NumberField), if necessary with visible=False to hide if from the user. Also, prevent storing very large amounts of data if not necessary, as this might make your application slow and unstable!

Output only

For more information on how to add an output field to the parametrization, that cannot be modified by the user, see OutputField. There is no value associated with an OutputField within the params.

Manual line break

For more information on how to add a manual line break to the parametrization, see LineBreak. There is no value associated with a LineBreak within the params.