Kindly EditDocumentationTry the editor

Conditions and calculations

Show or hide fields from answers, choose confirmations, emails and connections by rules, and calculate numbers.

Conditions show or hide fields as people answer, and decide which confirmation, email or connection applies. Calculations work out numbers, such as totals, from the answers. Both run in the visitor's browser as they type, and again on the server when the form is sent; the server never trusts the browser's result.

Show or hide a field#

  1. Choose the field and open its Conditions tab.
  2. Turn on Only when conditions are met.
  3. Choose Show or Hide, then how the rules combine:
    • all of these hold: every rule must hold;
    • any of these holds: one rule is enough;
    • any group holds: rules in groups. Each group needs all its rules (All of these, or all of these), and one group is enough. Add another group adds one.
  4. Add a rule: choose the answer it reads, the test, and the value.

The outline marks fields that a condition shows with if, and the Conditions tab shows a dot when a condition is on.

A rule can read any answer in the form except the field itself, including one part of a name or an address (such as the city). When the answer has choices, the value is picked from them. Otherwise type it, or compare with another answer by typing a smartcode such as {inputs.start_date}.

Conditions work on every kind of field:

  • Page break: the whole step is skipped when its condition doesn't hold.
  • Collapsible section, Columns and Repeating group: everything inside goes with it.
  • Inside a Repeating group, a rule can read the other fields of the same group.
  • Send button and Save and finish later: the button shows only when the rules hold.

Tests#

The tests offered depend on the answer the rule reads.

Test Holds when the answer
is, is not equals the value, ignoring capital letters. For Choose several, is holds when that choice is ticked
is more than, is less than, is at least, is at most compares as a number. Dates and times compare as dates
contains, doesn't contain includes the words. For Choose several, holds when that choice is ticked
starts with, ends with begins or ends with the words
is empty, isn't empty has no answer, or has one
is one of, is none of is in a list of values, separated by commas
matches the pattern matches a regular expression, such as ^[A-Z]
has this many characters, is longer than, is shorter than has that many characters (or, for several choices, that many ticked)
is before, is after, is on, isn't on is a date before, after or on the value (or a time of day, against a time). See below

Number fields, sliders, ratings, scores and scales offer the number tests. Choose one, drop-downs and countries offer is, is not, is one of, is none of and the empty tests. Choose several adds contains.

Dates and the time now#

Date conditions are in Kindly Edit 0.12.0 and later. Date fields offer is before, is after, is on and isn't on. The value can be a date (12/31/2026 or 2026-12-31) or a moving one: {today}, {tomorrow}, {yesterday}, or {today +7 days} (days, weeks, months or years, plus or minus). Times of day compare as times: 1:30 pm or 13:30, and {now}.

The rule's field can also be Today, Time now or Day of the week, at the end of the field list, for a field shown only before a date, only in the mornings or only on weekdays. They read the site's time zone (Settings, General), on the page and when the form is sent.

What a hidden field means#

  • A field hidden by a condition is not required and is not checked.
  • Its answer is not kept in the entry, and doesn't appear in emails or connections.
  • A rule that reads a hidden field reads it as empty. Chains of conditions (A shows B, B shows C) settle on their own.

Conditions elsewhere#

The same rule editor appears wherever something should happen only for some answers:

Where Toggle Effect
Settings > After sending Only when conditions are met The first switched-on confirmation whose rules hold is shown. When none holds, the first one without conditions is used.
Emails Send only when conditions are met The email is sent only when its rules hold.
Connections Run only when conditions are met The connection runs only when its rules hold.
Documents A part's conditions That part of the PDF document is left out when its rules don't hold.

See After sending, Connections and PDF documents.

Calculations#

Text, Number and Amount to pay have a Calculation setting, and each column of Repeating rows can have one. With a formula, the field fills itself in as people answer and can't be typed in. Leave it empty for a field people fill in.

Under the formula, Insert an answer puts in one of this form's answers, What can I write? shows the short guide, and the line below says Reads well. or what is wrong. On a Number, Hide the calculated box keeps the result out of sight while still sending it.

A formula is numbers, answers in braces and + - * / % ^ ( ):

{inputs.adults} * 25 + {inputs.children} * 10
round({inputs.subtotal} * 1.08, 2)
{inputs.guests} > 4 ? {inputs.guests} * 18 : {inputs.guests} * 20
Part Meaning
+ - * / % ^ ( ) Add, subtract, multiply, divide, remainder (also mod), power, grouping. Dividing by 0 gives 0
> < >= <= == != Comparisons give 1 or 0
&&, ||, ! before a value And, or, not
a ? b : c b when a is not 0, else c
! after a number Factorial, as in 5!
pi, e The constants
round(x, 2) floor ceil abs Rounding and absolute value
min max sum avg count Over any number of values; count counts the ones that aren't 0
pow(x, y) sqrt root(x, n) log ln exp Powers, roots and logarithms
sin cos tan asin acos atan sinh cosh tanh asinh acosh atanh Trigonometry
comb(n, k) perm(n, k) Combinations and permutations
if(test, a, b) a when the test is not 0, else b

Reading answers#

Reference Value
{inputs.qty} (also {qty}, {input.qty}) The answer as a number. Formatted numbers such as 1,234.56 or 1.234,56 are read by the field's Number format
{inputs.size} on a field with choices The chosen choice's number from Numbers for calculations, or its value when that is a number
{checkbox.extras} The sum of the ticked choices' numbers
{repeat.items} How many rows a repeating field has
{repeat.items.price} or {repeat.items.2} The sum of one column (by key, or by position) over every row
{date.diff.start.end} Whole days between two date answers
{payment.total}, {payment.subtotal}, {payment.discount}, {payment.recurring} The order's amounts, on forms with payment fields. See Payments

An answer that isn't there, or isn't a number, counts as 0. A formula that can't be read gives 0. A calculation can read another calculated field, wherever it is in the form.

Rounding#

With a Number format that has decimals (such as 1,234.56), the result is rounded to that many places. Otherwise it is kept to six decimal places; use round() in the formula for money. Amount to pay is always rounded to the currency's smallest unit.

Smartcodes in words#

Labels, help, Words and links, confirmations, emails and many other settings can show answers with smartcodes, such as {inputs.first_name}. In Words and links, {inputs.name} changes as the person types. The full list is in Smartcodes.

About this page

Documents Kindly Edit 0.9.16. Source: includes/forms/logic.php, assets/forms/logic.js, assets/forms/builder.js. Theme choices and account permissions can change which controls appear.

Type a word or phrase to search the full documentation.