Skip to main content

Form for data sources

The Form widget enables you to incorporate user interactivity into your data app. This widget allows you to configure various inputs, and it will then generate an interactive form for users to employ in filtering the data.

Widget Form

For uses when you don't want to filter a data source and just let the user choose or input from a defined set of values, you may use the Form for defined values

Basic usage

To use the Form widget, you need a Widget Query linked to some data source. Once you have your query, create a Form widget and configure its Input variable field. This widget works by filtering the input query and generating a new query result in the configured output variable. You may choose which columns you want in the result with the Output columns configuration. If no output columns are specified all be included in the output query.

Now, go to the 'Filters' tab, and start adding the columns you want to include in the form. For each item, you will select the column name and then the Selector you want to use for it.

When you have configured all your columns, save and you will see the form rendered in the widget. Now, if you fill all the fields, you can click on the Submit button to save the output on the selected variable. You can use this output on your Python code, or display it in a Table, Chart or KPI widget.

info

By default, all filters are included in the form as required fields. This will mean the execution of the notebook will stop until all the required fields are filled.

tip

If you do not want the execution to stop. You can either have no required fields, or have default values in all required fields.

Retrieve selected values

In addition to the resulting query that you will get in the Output variable of the widget. You may want to use any of the individually selected values of your configured filters. For that Widget form will add to the notebook context one variable per configured filter in the widget.

After the form is submitted you can read the value selected on other widgets or on the python code.

The variable names are constructed using the Output variable and the name of each filter (the column name).

For instance , a widget with an output variable named 'out1' and a filter for the column 'name' will add a variable named 'out1_name' to your context.

API reference

Basic

Setting nameTypeDescriptionDefault
Input variablewidget query variableThe input query that will be filtered. You will need a configured widget query for some data source.
Output columnsstringThe columns desired in the output query after filtering.
Output variablestringThe variable to store the output.

Filters

Configuration for each element added to the form.

Basic

Setting nameTypeDescriptionDefault
ColumnstringThe column name in the data source.
Typestring ReadonlyThe column type.
LabelstringThe label to show in the form.<column_name>
SelectorDropdown | Bool: as checkbox | Date selector: from | Date selector: to | Date selector: same day | Date range picker: dates | Date range picker: months | Date range picker: years | Date range picker: date and time | MultipleThe input type to useSelect
VisiblebooleanWhether to include the column in the form.true
PlaceholderstringThe placeholder to show in the input.
Default valuestringThe default value for the input.
Default select allbooleanWhether to select all options by default.false
RequiredbooleanWhether the input is required in the form.true
OrderNo order | Ascending order | Descending orderData sorting for the column elements.No order
Dependenciesstring/column_name[]Columns that this selector depends on. Changes on those dependencies will refresh the selector
Span1-24Number of grid cells for this item6
Offset0-24Number of grid cells to offset this item0

Format

Setting nameTypeDescriptionDefault
SuffixstringThe suffix for the value.
Numeral formatstringThe format to use for the column. See Numeral.js for more information.

Events

Setting nameTypeDescriptionDefault
Submit modesubmit button | submit on changeThe mode to submit the form.submit button
Submit button labelstringThe label for the submit button.Submit
Show reset buttonbooleanWhether to show a button to reset the form.false
Reset button labelstringThe label for the reset button.

Format

Format options for the form.

General

Setting nameTypeDescriptionDefault
Title layoutTop | InlineThe layout for the title (label) of each inputTop
Horizontal gutter8 | 16 | 24 | 32 | 40 | 48The horizontal gutter between the form elements, in pixels.24
Vertical gutter8 | 16 | 24 | 32 | 40 | 48The vertical gutter between the form elements, in pixels.24
Debug gridbooleanWhether to show the grid for the form.false

Buttons

Setting nameTypeDescriptionDefault
AlignStart | End | CenterThe alignment for the buttonsStart
Span1-24Number of grid cells for the buttons6
Offset0-24Number of grid cells to offset the buttons0

See also

  • All widgets — browse the full widget catalog.
  • Query — build the query this form filters.