Placeholder Formatting

Visforms Placeholders and Placeholder Formatting

Available since Visforms Version 6.1.0.

Numerous Visforms placeholders can be given additional placeholder formatting. This allows for individually formatted output of placeholder values and placeholder labels.

Note: Some of these features are part of the Visforms Subscription and are not included in the free Visforms version.

Note: Examples of placeholder formatting with specific values and their effects can be found on the page Placeholder Examples.

The Format Option

The format option and its extensive output formatting capabilities are applied retrospectively, i.e., only at the time of actual output.
They allow you to adapt the output values to the specific situation.

The format option for Visforms placeholders can take the following two forms:

  • Using the explicit FORMAT option with an appended formatting instruction:
    ${Name|FORMAT|(Function)Formatting}
    The explicit FORMAT option is available for the following placeholder types:
  • Field type Text
  • Field type Number
  • Field type Date
  • Field type Calculation
  • Field type Email
  • Field type Phone
  • All form properties
  • All form data properties
  • All Joomla user object information
  • All Joomla input object information
  • Extending the DISPLAYLABEL option with an appended Formatting instruction:
    ${Name|DISPLAYLABEL|(Function)Formatting}
    The DISPLAYLABEL option extension is available for all DISPLAYLABEL options.

The appended formatting instruction has the following structure:

  • (function)Formatting

Note: Curly braces {} and square brackets [] are not allowed in the appended formatting instruction and will result in an error.

The following formatting functions are available for function:

  • number for simple formatting of numbers (decimal places, thousands separator, decimal separator)
  • date for formatting a date
  • print for formatting text
  • float for mathematical/scientific formatting of numbers

The Format Functions

The “number” Format Function

The format function number corresponds to the PHP function PHP: number_format - Manual.
The placeholder value must be a number and can have decimal places.
The placeholder value can use a period or a comma as the decimal separator; both are possible and will be used accordingly.

Format Structure (Square brackets are omitted): (number)[Number of decimal places][Decimal separator][Thousands separator]
Note: The square brackets [] are omitted and are not included.

Example:

  • Placeholder: ${number1|FORMAT|(number)2.,} Replacement: 57,550.00

Further examples can be found here: Visforms Information with FORMAT Options: Form Fields

The “date” format function

The date format function corresponds to the PHP function PHP: date_format - Manual.
The placeholder value must be a valid date in text format.

When using a placeholder for information of type Date, all conditions are automatically met for the following placeholder types:

  • Field placeholders
  • Overhead placeholders
  • Joomla object placeholders
  • Special placeholders

Formatting structure: (date)[Date formatting]
Note: The square brackets [] are omitted and not included.

Examples:

  • Placeholder: ${date|FORMAT|(date)Y/m/d}
    Replacement: 2026/03/21
  • Placeholder: ${user:registerDate|FORMAT|(date)Y/m/d H:i:s}
    Replacement: 2021/11/19 09:17:01

Further examples can be found here:
Visforms Information with FORMAT Options: Form Fields
Joomla Information with FORMAT Options: User Object

The “print” format function

The print format function corresponds to the PHP function PHP: sprintf - Manual.
The print format function is available for all placeholder types and offers a wide range of possibilities.

Formatting structure: (print)[Output formatting]
Note: The square brackets [] are omitted and not written.

Examples:

  • Placeholder: ${first|FORMAT|(print)This is my entry: ' %s ‘} Replacement: This is my entry: ‘My first name '
  • Placeholder: ${calculate1|FORMAT|(float)%012.2f million bicycles} Replacement: 000017755.62 million bicycles
  • Placeholder: ${first|DISPLAYLABEL|(print) Measurement ( %s ) =} Replacement: Measurement ( first ) =

Further examples can be found here:
Visforms Information with FORMAT Options
Joomla Information with FORMAT Options

The “float” format function

The float format function corresponds to the PHP function PHP: sprintf - Manual.
The format function float works like the format function print, with the only difference being that the placeholder value is first converted into a number with decimal places of the data type Float. This conversion takes place immediately before the PHP function sprintf is applied. This is necessary because many mathematical/scientific formatting expects this data type as input.

Formatting Structure: (float)[Output Formatting]
Note: The square brackets [] are omitted and not written.

Example:

  • Placeholder: ${number1|FORMAT|(float)%X }} ((Hexadecimal notation in uppercase))
    Replacement: E0CE
  • Placeholder: ${number1|FORMAT|(float)%e }} (Scientific notation in lowercase)
    Replacement: 5.755000e+4

Further examples can be found here:
Visforms Information with FORMAT Options
Joomla Information with FORMAT Options

Overview: Placeholders with FORMAT Option

The following placeholder areas have the formatting option FORMAT available.

Field Placeholders

The formatting option FORMAT is available for the following form field types.

  • Text
  • Number
  • Date
  • Calculation
  • Email
  • Phone

Overhead Placeholders

  • All form properties
  • All form data properties

Joomla Object Placeholders

  • All Joomla user object information
  • All Joomla input object information

Special Placeholders

  • ${currentdate}: The current date