Skip to main content

Input Widget

OverviewDirect link to Overview

The Input widget is a versatile form component that allows users to enter and edit text, numbers, and other data types. It provides comprehensive validation, formatting, and styling options to create robust form interfaces.

Input Widget

Basic ConfigurationDirect link to Basic Configuration

Global SettingsDirect link to Global Settings

FieldDescriptionRequired
NameDisplay label for the input fieldYes
Variable/ModelVariable name to bind the input valueYes
Default ValueInitial value when the component loads: see Default ValueNo

Data TypesDirect link to Data Types

The input widget supports two primary data types:

String TypeDirect link to String Type

  • Use Case: Text input, formatted strings, masked inputs
  • Features:
    • Input masking for formatted entries
    • Text validation rules
    • Custom placeholder text

Number TypeDirect link to Number Type

  • Use Case: Numeric input with validation
  • Features:
    • Min/Max value constraints
    • Step increment control
    • See the Number widget for how these apply on the page

Data Type ConfigurationDirect link to Data Type Configuration

String ConfigurationDirect link to String Configuration

Input MaskingDirect link to Input Masking

Use masks to format user input automatically:

Mask CharacterPatternDescription
#/\d/Numeric digit
X/[0-9a-zA-Z]/Alphanumeric character
S/[a-zA-Z]/Alphabetic character
A/[a-zA-Z]/Uppercase alphabetic
a/[a-zA-Z]/Lowercase alphabetic
!Escape characterLiteral character

Example Masks:

  • Phone Number: + ## # ## ## ## ##
  • Credit Card: #### #### #### ####
  • Date: ##/##/####
Input String Configuration

Number ConfigurationDirect link to Number Configuration

SettingDescriptionDefault
MinMinimum allowed valueNone
MaxMaximum allowed valueNone
StepIncrement/decrement step1
PrecNot applied on the pageNone
Input Number Configuration

Validation and RulesDirect link to Validation and Rules

Custom Validation RulesDirect link to Custom Validation Rules

Add custom validation rules with:

  • Rule Type: Select from predefined validation patterns
  • Value: Validation parameter (e.g., minimum length)
  • Message: Custom error message to display
Input Custom Validation Rules

Email WidgetDirect link to Email Widget

The Email tile of the palette (Form group) adds an Input that already has the Email rule in its Rules section. Everything else works as on any other Input.

An Email widget and its Email rule in the Rules section

When the user leaves the field, the page checks the format of the address: jean.dupont@example.com is accepted, while jean.dupont@example and jean dupont@example.com show the message of the rule under the field.

The message of the Email rule under an address with a wrong format
  • Empty field: the rule only checks an address that has been typed. To make the address mandatory, also turn on Required in the Validation section.
  • Message: Format Email by default. Change it in the third field of the rule. The dictionary of the page does not translate this message: write it in the language of your users.
  • Format: the format is fixed. Whatever the second field of the rule holds, it is not used. For another format, use a Regex rule.
  • On any Input: to get the same check, click Add rule in the Rules section, choose Email and write the message in the third field: without a message, the user sees a technical error.

Screen-based ValidationDirect link to Screen-based Validation

Configure different validation behaviors for different screens:

PropertyDescription
AvailableWhether the widget appears on this screen
VisibleWhether the widget is visible (can use conditions)
RequiredWhether the field is mandatory
DisableWhether the field is read-only
Input Screen Validation

Styling OptionsDirect link to Styling Options

Basic StylingDirect link to Basic Styling

PropertyDescriptionExample
PlaceholderHint text displayed when empty"Enter your name"
WidthComponent width"100%", "200px"
ClassCSS classes for custom styling"custom-input, large"

Dynamic ClassesDirect link to Dynamic Classes

Configure classes that change based on conditions:

  • Use the dynamic classes editor
  • Reference form variables and data
  • Apply conditional styling
Input Styling

Advanced FeaturesDirect link to Advanced Features

Default ValueDirect link to Default Value

The Default Value field of the Global card gives the field its value when the page opens. Input, Text Area, Number, Date and Currency share this field, and this section is their reference. A Dropdown and a Radio read less: see Select and Radio.

The field has 1 to 6 lines (5 to 10 on a Text Area), an fx corner, the placeholder Text or =formula (Number or =formula with the Number type) and an Expand the editor button that opens the large editor. A click in an empty field lists the suggestions:

Input Dynamic Default Values

What You Can WriteDirect link to What You Can Write

You writeExampleWhat the page does
A fixed textParisShows this text
A variable{{city}} or ${city}Shows the value of the variable
Text with variablesHello {{firstName}}Shows the text, with the variables replaced
A formula, starting with ==[{{firstName}}, {{lastName}}].filter(Boolean).join(" ")Shows the result of this JavaScript expression
  • A formula is one expression: const, if or return are not accepted directly. For several lines, start from the Script on several lines suggestion
  • A field of the same Form: {{form.field}}, where form is the variable of the Form
  • A field of the same loop row: {{field}}

When It Is ComputedDirect link to When It Is Computed

The value is set when the page opens, if the variable does not exist yet: a value already saved, for example in a reopened task, is kept. A line under the field then says what happens next:

  • Computed again when this changes: … The value follows these variables, and each change replaces what the user typed
  • Computed only once, when the page opens. The value follows nothing, for example with a formula that reads no variable or with {{SF_connectedUser.mail}}
Input Dynamic Default Value

SuggestionsDirect link to Suggestions

The list opens when an empty field gets focus, after {{, after ${, after a = at the start, after moment()., Math. or {{x}}. in a formula, and with Ctrl+Space. It also follows the name of a field as you type it. Its sections are Fields of the page, Connected user, Page and URL and Formulas; Connected user is only offered for a text value, not with the Number type or on a Date or a Currency.

The arrow keys move in the list, Enter or Tab inserts the entry and Escape closes the list. When the list is closed, Enter adds no line in an Input: use Shift+Enter or the large editor.

Messages and FixDirect link to Messages and Fix

When a value will not do what it seems to, a message under the field says what the page will do. A click on the message opens the large editor, where it comes with a Fix button when the correction is known:

You wroteWhat the page doesFix writes
A space before =1+1Shows this text as written, without computing it=1+1
{{SF_mode}}Leaves the value empty=this.$root.SF_mode
{{new Date()}}Reads this code as a field name: the field can disappear from the page=new Date()

The Large EditorDirect link to The Large Editor

Expand the editor opens the Default Value drawer, with a code editor and the same suggestions. Nothing is written before Save; Cancel closes the drawer and leaves the value as it was. The drawer holds:

  • The help: What this field reads
  • The state of the value: Its kind (Fixed value, Variable, Text with variables, Calculation, Formula) and the line that says when it is computed
  • The messages: Each with its Fix button when the correction is known
  • Result: The value the page would give, with the default values of the other fields. Type a test value next to a variable to try another case. A code that holds a loop is computed on request, with Compute
  • The search column: Fields of the page, Connected user, Page and URL and Formulas. A click inserts the entry

Event HandlingDirect link to Event Handling

onChange EventDirect link to onChange Event

Triggered when the input value changes:

  • Access the new value via event parameter
  • Automatically enforces min/max constraints for numbers
  • Can trigger custom actions and functions

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

You can attach custom actions to the input widget's onChange event to respond to value changes in real-time. This is useful for:

  • Updating other fields based on the input value
  • Triggering calculations or validations
  • Fetching related data from the backoffice
  • Implementing cascading field updates

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

  1. Navigate to the Global section in the widget configuration
  2. In On Change, click Action on field change (View attached action once an action is saved). The drawer titles this chain On Click
  3. You can attach actions to the widget
  4. The system will execute your code whenever the input value changes

Accessing Values with SF_inputDirect link to Accessing Values with SF_input

When working with onChange events, you have access to the SF_input object that contains information about the value change:

SF_input Structure for Input WidgetDirect link to SF_input Structure for Input Widget

{
  value: /* The value after the change */,
  SF_currentIndex:  /*  The index of the loop where the change has been done, This is only available for Inputs inside a loop */
}

Best Practices for ActionsDirect link to Best Practices for Actions

  1. Keep Actions Lightweight: Avoid heavy computations in onChange events
  2. Debounce API Calls: If fetching data, consider debouncing to avoid excessive requests
  3. Handle Errors: Always include error handling in your action code
  4. Validate Input: Check if values exist before using them
  5. Use Clear Variable Names: Make your code readable for future maintenance

Currency SupportDirect link to Currency Support

Special handling for currency inputs:

  • Automatic formatting based on locale
  • Currency symbol display
  • Decimal precision control

Integration FeaturesDirect link to Integration Features

Form IntegrationDirect link to Form Integration

When used within a form:

  • Automatic form validation
  • Submit/reset handling
  • Parent form state management

Loop IntegrationDirect link to Loop Integration

When used in loops:

  • Access to loop index via SF_currentIndex
  • Independent validation per loop item
  • In a rule, a default value, or a Title or Text widget of the row, {{field}} reads the field of the same row
  • One ID per row: <id> on row 0, <id>_<n> on row n, and data-sf-id="<id>" on every row. See Loop › Rows at Runtime

Action IntegrationDirect link to Action Integration

Configure actions on the On Change event:

  • Custom JavaScript functions
  • API calls and data operations
  • Navigation and UI interactions

Usage ExamplesDirect link to Usage Examples

Basic Text InputDirect link to Basic Text Input

Basic Text Input

Phone Number with MaskDirect link to Phone Number with Mask

Input Phone Number

Numeric Input with ConstraintsDirect link to Numeric Input with Constraints

Input Numeric Input with Constraints

Conditional VisibilityDirect link to Conditional Visibility

A field can be shown only when a condition is true:

  1. In the Validation card of the widget, click Advanced Setting: the switches of the rows become pencil buttons (Easy Setting switches back). With a single screen selected in the All Screens selector above the canvas, the pencils are already displayed.
  2. Click the pencil of the Visible column, on the row of the screen (with a single screen selected, the pencil of the Visible row).
  3. In the Advanced Setting Condition dialog, write the condition. Use {{variable}} to read any variable of the interface.
  4. Click Apply for this screen, or Apply to All screens.
  5. Click Save interface in the right rail, or the Saved indicator, to keep the condition: Apply does not start the automatic save. Without this, the condition is lost when you leave the page, unless a later change has started the automatic save. See The Condition Editor.

The Required and Disable conditions use the same dialog.

Simple ConditionsDirect link to Simple Conditions

A single comparison: the field is visible when the role variable is admin.

Input Simple Conditions

Complex ConditionsDirect link to Complex Conditions

Combine several comparisons with && and ||.

Input Complex Conditions

Best PracticesDirect link to Best Practices

Field NamingDirect link to Field Naming

  • Use descriptive variable names
  • Follow consistent naming conventions
  • Avoid spaces and special characters in variable names

ValidationDirect link to Validation

  • Provide clear error messages
  • Use appropriate data types
  • Set reasonable min/max constraints

User ExperienceDirect link to User Experience

  • Use meaningful placeholders
  • Group related fields logically
  • Provide immediate feedback on validation

PerformanceDirect link to Performance

  • Avoid complex default value expressions
  • Use efficient validation rules
  • Minimize unnecessary re-renders

TroubleshootingDirect link to Troubleshooting

Common IssuesDirect link to Common Issues

  1. Validation Not Working

    • Check required field configuration
    • Verify custom validation rules syntax
    • Ensure proper screen validation setup
  2. Mask Not Applied

    • Verify mask syntax using supported characters
    • Ensure string data type is selected
    • Check for conflicting CSS styles
  3. Default Values Not Loading

    • Verify variable references exist
    • Check expression syntax
    • Ensure referenced data is available
  4. Styling Issues

    • Verify CSS class names
    • Check width/height values
    • Ensure proper CSS specificity

Debug TipsDirect link to Debug Tips

  • Use browser developer tools to inspect generated HTML
  • Check console for JavaScript errors
  • Verify form data binding in Vue DevTools
  • Test validation rules independently

Browser CompatibilityDirect link to Browser Compatibility

The input widget is compatible with:

  • Chrome 60+
  • Firefox 55+
  • Safari 12+
  • Edge 79+
  • Textarea Widget: For multi-line text input
  • Select Widget: For dropdown selections
  • Date Widget: For date/time input
  • Currency Widget: For specialized currency handling