Skip to main content

Select Widget

OverviewDirect link to Overview

The Select widget is a dropdown component that allows users to choose one or multiple options from a predefined list. It supports various data sources and provides extensive customization options for different use cases.

Select Widget
Select Widget

Basic ConfigurationDirect link to Basic Configuration

Global SettingsDirect link to Global Settings

NameDirect link to Name

  • Field: Name
  • Description: Display name for the widget
  • Type: Text input
  • Required: Yes

Variable/ModelDirect link to Variable/Model

  • Field: Variable/Model
  • Description: The variable name that will store the selected value(s)
  • Type: Text input
  • Required: Yes
  • Note: This is the data binding variable for the widget

Default ValueDirect link to Default Value

  • Field: Default Value
  • Description: Pre-selected value when the widget loads
  • Single selection: The value of an option, or a variable written {{x}}, the form the suggestions insert (${models.x} still works, and a URL parameter stays ${$root.parameter}). This field does not read = formulas, and the value is computed only once, when the page opens
  • In the field: The placeholder is Value of an option, and there is no fx corner. The suggestions open when an empty field gets focus, after ${ and with Ctrl+Space; for a Static source with a list, they start with the section Options of the list. The Expand the editor button opens the large editor
  • Messages: A = is flagged under the field, because the page would show the text as written. In the large editor, Fix gives the correction when one is known
  • Multiple selection (Multi on): A list of fixed values, chosen in the field (Values selected when the page opens). The field says so: Multiple list: the page only reads fixed values, no variable. Since 8.6 these values are applied when the page opens; before, a multiple Dropdown always started empty
  • Switching Multi: The existing value is converted. With Multi on, it becomes the first value of the list; with Multi off, the field keeps the first value of the list
With Multi on, the Default Value holds the values selected when the page opens.
With Multi on, the Default Value holds the values selected when the page opens.

Selection OptionsDirect link to Selection Options

Multiple SelectionDirect link to Multiple Selection

  • Field: Multi
  • Description: Enable selection of multiple options
  • Type: Toggle switch
  • Default: false
  • Effect: When enabled, users can select multiple items and the result will be stored as an array

ClearableDirect link to Clearable

  • Field: Clearable
  • Description: Allow users to clear the selected value(s)
  • Type: Toggle switch
  • Default: true for a new Dropdown
  • Effect: Adds a clear button to remove selections

FilterableDirect link to Filterable

  • Field: Filterable
  • Description: Enable search/filter functionality within the dropdown
  • Type: Toggle switch
  • Default: true for a new Dropdown
  • Effect: Adds a search input to filter available options
The Global card of a Dropdown: Name, Variable/Model, Default Value, Multi, Clearable, Filterable and On Change.
The Global card of a Dropdown: Name, Variable/Model, Default Value, Multi, Clearable, Filterable and On Change.

Data Source ConfigurationDirect link to Data Source Configuration

The Data Source card offers six source types: Static, Collection, Report, SoftyTable, Variable and EDS.

Static DataDirect link to Static Data

  • Source Type: Static
  • Configuration: Custom List
  • Description: Use predefined static data from custom lists
  • Setup:
    1. Select "Static" in Data Source
    2. Click the Options / Values button (Add static List when no list is chosen) to choose or create a custom list
    3. Options will be loaded from the selected list
  • Language of the labels: The labels of the list are shown in the language of the user. A list can be translated into 16 languages (see Translating the Labels), and a language left empty shows the original label. The <variable>_label variable keeps the original label
  • No list chosen: Since 8.6, a Static source with no list simply gives an empty list
A Static source: the Options / Values button opens the custom list in a drawer.
A Static source: the Options / Values button opens the custom list in a drawer.

Collection DataDirect link to Collection Data

  • Source Type: Collection
  • Configuration: Database Collection
  • Description: Load options from a database collection
  • Setup:
    1. Select "Collection" in Data Source
    2. Choose the target collection: the list shows the collections of the open project first (This project), then those of the Other projects with the name of their project
    3. Configure label and value field mappings
    4. Set optional query filters, sorting, and limits
A Collection source: the collection, the Options block with Label and Value, then Query and Sort By.
A Collection source: the collection, the Options block with Label and Value, then Query and Sort By.

Report DataDirect link to Report Data

  • Source Type: Report

  • Configuration: Report Query

  • Description: Load options from report results

  • Setup:

    1. Select "Report" in Data Source
    2. Choose the target report
    3. Configure label and value field mappings
    4. Set optional query filters, sorting, and limits
A Report source: the report, Label and Value, Query, Sort By and Limit.
A Report source: the report, Label and Value, Query, Sort By and Limit.

External Database (SQL)Direct link to External Database (SQL)

  • Source Type: EDS

  • Configuration: External Database Connection

  • Description: Load options from external database queries (SQL, LDAP, Google Sheets, API) declared in EDS

  • Setup:

    1. Select "EDS" in Data Source
    2. Choose the connection in Database
    3. Click Edit next to EDS Source to write the query
    4. Set label and value field mappings
An EDS source: the connection in Database, Label and Value, and EDS Source. The next card, Variable Mappings, is described under Field Mapping.
An EDS source: the connection in Database, Label and Value, and EDS Source. The next card, Variable Mappings, is described under Field Mapping.

VariableDirect link to Variable

  • Source Type: Variable
  • Description: The options come from the variable <model>_vb (the panel shows its name), which the page fills. Where to write it depends on the page setting Remove VB lists from the model:
    • On (the default for a page created in the IDE): the list is read from management.<model>_vb. Fill it from the code of the page: a setModel action writes models.<model>_vb, which the widget does not read, and the list stays empty
    • Off: the list is read from models.<model>_vb, so a setModel action works
  • Setup: Set the label and value field mappings, then fill the list once the page is mounted: the widget empties it when it starts
// On Mounted script of the page, with "Remove VB lists from the model" on
this.$set(this.management, 'categorie_vb', [
  { name: 'Achats', _id: 'achats' },
  { name: 'Ressources humaines', _id: 'rh' }
]);

SoftyTableDirect link to SoftyTable

  • Source Type: SoftyTable
  • Description: Load options from the rows of a SoftyTable
  • Setup: Choose the SoftyTable, then the Label Column and the Value Column

Field MappingDirect link to Field Mapping

For dynamic data sources (Collection, Report, EDS, Variable), configure field mappings. A Label left empty reads the name field, and a Value left empty reads the _id field.

Label FieldDirect link to Label Field

  • Purpose: Defines what text is displayed to users
  • Static Use: firstName
  • Dynamic Use: $.firstName + ' - ' + $.lastName
  • Support: Expressions using $ prefix for field references

Value FieldDirect link to Value Field

  • Purpose: Defines what value is stored when an option is selected
  • Static Use: id
  • Dynamic Use: $.id + '-' + $.type
  • Support: Expressions using $ prefix for field references

Fields of a CollectionDirect link to Fields of a Collection

For a Collection source, Label (displayed text) and Value (stored value) are stacked in the Options block and take its whole width, so a key is no longer cut off.

  • The list: A click in a field lists all the fields of the collection, each with a type badge and a sample value. The title of the list gives the name of the collection and the number of fields. A collection has no schema: the fields are read from its first TEST document
  • The badges: Abc (text), 123 (number), ID, Date, Bool (yes/no), [ ] (list), { } (object) and ∅ (empty in the first document). The field shows the badge of the chosen key, ƒx for an expression and ? for a name the first document does not have
  • Filtering: Typing filters the list, whatever the case, and highlights what matches
  • Long names: The list shows the names in full. In the field, a name that does not fit appears in full on hover
  • Free text: You can still type a field that is not listed, or an expression such as $.a + ' - ' + $.b
For a collection, a click in Label or Value lists the fields of the collection, with their type and a sample value.
For a collection, a click in Label or Value lists the fields of the collection, with their type and a sample value.

Variable MappingsDirect link to Variable Mappings

The Variable Mappings card copies fields of the selected option into variables of the page, with no action to write: choosing a product can fill its price and the email of its supplier. It appears for a Collection, Report or EDS source, on a Dropdown without Multi and on a Radio.

  • Add Mapping: Adds a row
  • Source path: The field to read in the selected option, by its name or a nested path (prix, fournisseur.email)
  • Target variable: The variable that receives the value. The field suggests the variables of the project as you type

The copy runs each time the value of the widget changes, whether the user or the code changes it. When no option matches the value any more, for example when the selection is cleared, each target variable receives an empty text.

The Variable Mappings card of a Dropdown on a collection: each row copies a field of the selected option into a variable.
The Variable Mappings card of a Dropdown on a collection: each row copies a field of the selected option into a variable.

Query ConfigurationDirect link to Query Configuration

The Data Query PopupDirect link to The Data Query Popup

The Edit button next to Query (Aggregation when the Aggregation switch is on, EDS Source for an EDS) opens the Data query popup. It is the popup of the Table widget, without its test block, and the Radio, Checkbox and Autocomplete widgets use it too. It holds:

  • The header: The source, the resource and the variable of the widget (for example Collection · Produits_NBg · categorie), with the Cancel and Save buttons
  • The Aggregation switch: For a Collection or Report source
  • The help: What this source expects, with an example
  • The editor: The query, in JavaScript
The Data query popup of a Dropdown on a collection: the Aggregation switch, the help for this source and a filter that uses a page variable.
The Data query popup of a Dropdown on a collection: the Aggregation switch, the help for this source and a filter that uses a page variable.

The help follows the source:

SourceQuery expectedExample
CollectionA MongoDB filter written in JavaScript. Page variables go between double braces.{ status: "active", category: {{selectedCategory}} }
Collection or Report, Aggregation onA MongoDB aggregation pipeline: an array of stages, in JavaScript.[{ $match: { status: "active" } }, { $group: { _id: "$category", total: { $sum: 1 } } }]
ReportA filter on the measures of the report (and SF_status, SF_createdAt, SF_createdBy…), in JavaScript.{ amount: { $gt: {{minAmount}} } }
EDS (SQL)An SQL query written as a JavaScript string: page variables are added between double braces."SELECT * FROM clients WHERE city = '" + {{city}} + "'"
EDS (LDAP)An LDAP object: the branch to read and the search parameters.{ source: "ou=users,ou=system", params: { filter: "(objectClass=person)", scope: "sub", attributes: ["cn", "sn"] } }
EDS (Google Sheets)A Google Sheets query written as a JavaScript string."select * where A <= " + {{maxValue}}

The list reloads when the query changes. Since 8.6, only the answer to the latest request is displayed: an older answer that arrives later is dropped.

Basic QueryDirect link to Basic Query

  • Purpose: Filter and customize data retrieval
  • Language: JavaScript with variable support
  • Variables: Use {{variableName}} for interface variables, without quotes around them
  • Example: { status: "active", category: {{selectedCategory}} }

AggregationDirect link to Aggregation

  • Purpose: Use aggregation pipelines for complex data processing
  • Availability: Collection and Report sources
  • Switch: Aggregation in the Data query popup (help: The query is a pipeline: [{ $match: … }, { $group: … }].)
  • Effect: The panel shows Aggregation instead of Query and hides Sort By and Limit: sort and limit in the pipeline
  • Example:
With Aggregation on, the query is a pipeline and the help of the popup follows.
With Aggregation on, the query is a pipeline and the help of the popup follows.

SortingDirect link to Sorting

  • Sort By: Field name to sort by (not offered for an EDS: sort in the query)
  • Direction:
    • 1 for ascending
    • -1 for descending

LimitDirect link to Limit

  • Purpose: Restrict number of options loaded (Collection and Report sources)
  • Type: Number input
  • Default: 100 for a new Dropdown
  • Use Case: Performance optimization for large datasets

Validation RulesDirect link to Validation Rules

Required ValidationDirect link to Required Validation

  • Configuration: Per screen basis
  • Options:
    • Boolean toggle for simple required/not required
    • Advanced conditions using JavaScript expressions
  • Message: Not configurable: the name of the widget followed by the text isrequired of the dictionary (for example Category is required)

Custom RulesDirect link to Custom Rules

Add additional validation rules in the Rules card: click Add rule, choose the type, then enter its value and the error message.

  • Min (Char) / Max (Char): Minimum and maximum number of characters of the value. With Multi, they reject every value, even an empty selection: do not use them to set a number of selections
  • Type: Expected type of the value (array, date, number). The value of a Dropdown is the Value of the option, or an array with Multi: array only passes with Multi, number only with a numeric value, and date never passes
  • Email: The value must be an email address (the value of the rule is locked). With Multi, the rule only passes with exactly one selected option
  • Regex: The value must match a regular expression. With Multi, it is tested on the values joined by commas
  • Custom: A condition to satisfy, where SF_input is the value of the field. It is also checked when the field is empty

To set a number of selections, use Custom with Multi: SF_input.length >= 2 requires at least two selected options.

The Rules card: the types offered by Add rule.
The Rules card: the types offered by Add rule.

Screen-Based ConfigurationDirect link to Screen-Based Configuration

Configure widget behavior per screen:

AvailabilityDirect link to Availability

  • Purpose: Control if widget exists on specific screens
  • Options: Boolean or conditional expression

VisibilityDirect link to Visibility

  • Purpose: Control if widget is visible on specific screens
  • Options: Boolean or conditional expression
  • Advanced: JavaScript conditions using {{variables}}

Required StatusDirect link to Required Status

  • Purpose: Control if widget is required on specific screens
  • Options: Boolean or conditional expression

Disabled StateDirect link to Disabled State

  • Purpose: Control if widget is disabled on specific screens
  • Options: Boolean or conditional expression
The Validation card: one row per screen, with Available, Visible, Required and Disable.
The Validation card: one row per screen, with Available, Visible, Required and Disable.

Styling and LayoutDirect link to Styling and Layout

Placeholder TextDirect link to Placeholder Text

  • Field: Placeholder
  • Purpose: Help text displayed when no option is selected
  • Example: "Please select an option"

WidthDirect link to Width

  • Field: Width
  • Purpose: Control widget width
  • Format: CSS width values (px, %, em, etc.)
  • Example: "300px", "100%"

Tag StyleDirect link to Tag Style

  • Field: Tag Style
  • Purpose: Show the options of the open list as coloured tags
  • Source: A Static source only: with any other source, the switch has no effect
  • Colours: Those of the custom list: the light colour for the background, the dark colour for the text and the border. An option with no colour takes a light blue background with blue text
  • Scope: The open list only: the value displayed in the field stays plain text
With Tag Style on a Static source, the options of the open list are tags in the colours of the custom list.
With Tag Style on a Static source, the options of the open list are tags in the colours of the custom list.

CSS ClassesDirect link to CSS Classes

  • Field: Class
  • Purpose: Add custom CSS styling
  • Types:
    • Static Classes: Space-separated class names
    • Dynamic Classes: Conditional classes based on data state
The Style card: Placeholder, Width, Tag Style and Class.
The Style card: Placeholder, Width, Tag Style and Class.

Event HandlingDirect link to Event Handling

On Change EventDirect link to On Change Event

  • Purpose: Execute custom actions when selection changes
  • Language: JavaScript
  • Available Variables:
    • SF_input.value: Selected value
    • SF_input.SF_data: Complete selected object
    • SF_input.SF_currentIndex: Loop index (if in a loop)

Action IntegrationDirect link to Action Integration

  • V2 Interface: Use visual action builder
  • Legacy: Direct JavaScript function calls
  • Parameters: Access to selection data and context
Action on field change opens the Actions drawer. SF_input gives the selected value and the selected object.
Action on field change opens the Actions drawer. SF_input gives the selected value and the selected object.

Working with Actions and SF_inputDirect link to Working with Actions and SF_input

Attaching Actions to onChange EventDirect link to Attaching Actions to onChange Event

The select widget's onChange (or onClick) event enables you to execute custom JavaScript whenever the user changes their selection. This is essential for:

  • Auto-filling related form fields with data from the selected option
  • Triggering cascading dropdowns or dependent field updates
  • Fetching additional information from the backoffice based on selection
  • Implementing dynamic form behavior and calculations

How to Attach an ActionDirect link to How to Attach an Action

  1. Open the Global card in the select widget configuration
  2. On the On Change row, click Action on field change (View attached action when an action already exists)
  3. In the Actions drawer, add your actions (the drawer names the trigger On Click). You can write plain JavaScript directly in the action fields
  4. The code executes automatically when the user makes a selection

Accessing Values with SF_inputDirect link to Accessing Values with SF_input

The select widget provides comprehensive data access through the SF_input object. The key advantage is that you get both the selected value AND the complete data object from your data source.

SF_input Structure for Select WidgetDirect link to SF_input Structure for Select Widget

For single selection mode:

{
  value: /* The selected value based on your "Value Property" */,
  SF_data: /* Complete JSON object of the selected item */,
  SF_currentIndex: /* Loop index if widget is inside a loop */
}

For multiple selection mode (when "Multi" is enabled):

{
  value: [/* Array of selected values */],
  SF_data: [/* Array of complete selected objects */],
  SF_currentIndex: /* Loop index if widget is inside a loop */
}

Understanding SF_input PropertiesDirect link to Understanding SF_input Properties

PropertyDescriptionSingle Select ExampleMulti Select Example
valueSelected value(s) from your "Value Property" configuration'CUST001'['CUST001', 'CUST002']
SF_dataComplete JSON object(s) for selected item(s){id: 'CUST001', name: 'John', ...}[{id: 'CUST001', ...}, {...}]
SF_currentIndexCurrent iteration index if widget is in a loop0, 1, 2, ...0, 1, 2, ...

Practical ExamplesDirect link to Practical Examples

Example 1: Access Selected ValueDirect link to Example 1: Access Selected Value

// Get the selected value (single select)
console.log(SF_input.value);
// Output: 'CUST001'

// For multiple select
console.log(SF_input.value);
// Output: ['CUST001', 'CUST002', 'CUST003']

// Store the selected value in another field
model.selected_customer_id = SF_input.value;

Example 2: Access Complete JSON Object (SF_data)Direct link to Example 2: Access Complete JSON Object (SF_data)

This is the most powerful feature - accessing the full data object, not just the value:

// Access the complete data object for the selected item
console.log(SF_input.SF_data);
// Output: {
//   id: 'CUST001',
//   name: 'John Doe',
//   email: 'john@example.com',
//   phone: '+1234567890',
//   address: {
//     street: '123 Main St',
//     city: 'New York',
//     country: 'USA'
//   },
//   credit_limit: 5000,
//   status: 'active'
// }

// Access any property from the selected object
model.customer_email = SF_input.SF_data.email;
model.customer_phone = SF_input.SF_data.phone;
model.customer_status = SF_input.SF_data.status;

// Access nested properties
model.customer_city = SF_input.SF_data.address?.city;
model.customer_country = SF_input.SF_data.address?.country;

Best PracticesDirect link to Best Practices

  1. Always Check SF_data Exists: Before accessing SF_data properties, verify it's not null

    if (SF_input.SF_data) {
      // Your code here
    }
    
  2. Use Optional Chaining: For nested properties, use optional chaining to avoid errors

    const city = SF_input.SF_data?.address?.city || 'Unknown';
    
  3. Handle Both Single and Multi Select: If your widget might switch between modes, handle both cases

    const selectedData = Array.isArray(SF_input.SF_data) ? SF_input.SF_data : [SF_input.SF_data];
    
  4. Leverage SF_data for Rich Data: Always use SF_data when you need more than just the value - it contains the complete record

  5. Clear Previous Data: When selection changes, clear dependent fields to avoid stale data

    model.related_field_1 = null;
    model.related_field_2 = null;
    // Then populate with new data
    
  6. Error Handling: Wrap data fetching in try-catch blocks

    try {
      const data = await SF_executeAction('fetchData', { id: SF_input.value });
      // Process data
    } catch (error) {
      console.error('Error fetching data:', error);
      model.error_message = 'Failed to load data';
    }
    
  7. Performance: For expensive operations, consider debouncing or showing loading indicators

Best PracticesDirect link to Best Practices

  1. Performance: Use limits for large datasets
  2. User Experience: Enable filtering for lists with 10+ items
  3. Validation: Provide clear error messages
  4. Accessibility: Use descriptive labels and placeholders
  5. Data Integrity: Validate selected values against available options
  6. Responsive Design: Set appropriate widths for different screen sizes

TroubleshootingDirect link to Troubleshooting

Common IssuesDirect link to Common Issues

  1. No Options Displayed

    • Check data source configuration (a Static source with no list gives an empty list; for a Variable source, check where the list is written)
    • Verify query syntax and variables
    • Ensure proper field mappings
  2. Performance Issues

    • Add appropriate limits
    • Use filtering instead of loading all data
    • Consider pagination for very large datasets
  3. Validation Errors

    • Check required field configuration
    • Verify custom validation rules
    • Ensure proper screen-based settings
  4. Selection Not Saving

    • Verify variable/model configuration
    • Check data type compatibility
    • Ensure proper form submission handling