Currency field

Use currency_input to collect a money amount from a respondent. Currency-specific settings control the placeholder and the currency symbol shown with the amount.

Configuration

NameTypeRequiredDefaultDescription
typestringYesn/aSet to currency_input.
namestringYesn/aAt least 1 character. Use letters, digits and underscores, starting with a letter. This is the field’s key in submission data.
labelstringNoNoneMain question text. Supports {{field}} piping.
subtextstringNoNoneSmaller text under the label. Supports {{field}} piping.
input_labelstringNoNoneSmall text above the input. Supports {{field}} piping.
requiredbooleanNofalseWhether the respondent must answer before leaving the page. A required field shows * after its label.
visible_ifcondition arrayNoNone (always shown)Show the field only when the condition is true. An empty array hides it. See shared properties.
hide_ifcondition arrayNoNone (never hidden)Hide the field when the condition is true. See shared properties.
placeholderstringNo0.00Grey hint text inside the input. Supports {{field}} piping.
defaultValuestringNoNonePrefills the input with a number written as a string, such as "49.99". May be "{{hidden_name}}".
currencystringNoUSDISO currency code, such as USD, EUR or GBP. The corresponding symbol appears before the amount; if the code has no known symbol, the code appears instead.

The amount is displayed with thousands separators and two decimals. The shared properties also define how the field behaves when required, hidden, or conditionally shown. See shared properties.

Respondent validation

A required field with no answer blocks the respondent from continuing. Characters other than digits and the decimal point are dropped as they type. Hidden fields are skipped during validation.

Submission value

The field stores a number, or null when empty. Its name is the key in submission data. For example:

{ "donation_amount": 49.99 }

Example

{ "type": "currency_input", "name": "donation_amount", "label": "How much would you like to donate?", "subtext": "Choose an amount in US dollars.", "input_label": "Amount", "placeholder": "25.00", "defaultValue": "49.99", "currency": "USD", "required": true }