Skip to content
ankerform

Technology9 min read

Using Conditional Logic Well: Rules That Make Forms Shorter and Data Better

How to plan conditional logic in forms: conditions, AND/OR groups and actions such as show/hide or skipping steps – with practical examples from real estate.

Tidy workspace with a laptop on a wooden desk

A form that asks everyone the same questions is too long for almost everyone. Someone looking to rent a flat does not need questions about financing; someone selling does not need to say how many rooms they are looking for. Conditional logic solves this: the form responds to answers and shows only what is relevant in each case. Used well, it makes forms shorter, clearer and produces cleaner data. Used badly, it creates a tangle of rules nobody can follow any more. This article shows how to plan rules, which building blocks exist and which mistakes to avoid.

What conditional logic actually is

Every rule has two parts: a condition and an action. The condition checks one or more values in the form, for example “Enquiry type equals Sale”. If it is met, the action runs, such as “Show the property details section”. If not, the default state applies. That sounds simple, and each individual rule should stay exactly that simple. Complexity only arises from the interplay of many rules.

In Ankerform, rules are not clicked together in the browser and forgotten; they are stored as part of the form schema and re-evaluated on every input. If someone changes an earlier answer, all dependent fields adjust immediately. Hidden fields are no longer treated as required, and you decide whether their values are discarded.

Conditions: the available operators

Which conditions you can express depends on the operators. The Ankerform rule engine supports the following comparisons:

OperatorMeaningTypical example
eq / neqequals / does not equalEnquiry type equals “Letting”
gt / gte / lt / ltegreater, greater or equal, less, less or equalNet household income is less than €2,500
containscontainsDesired features contain “Balcony”
empty / filledempty / filled inPhone number is filled in
before / afterdate before / afterMove-in date is before 1 March
formulacustom expressionPurchase price divided by floor area is greater than 6,000

With “formula” you can combine values before comparing them. This helps when the real decision depends not on one field but on a ratio, such as rent to income. Use formulas deliberately: they are powerful, but harder for colleagues to read than a simple comparison.

AND and OR groups

Multiple conditions are combined into groups. In an AND group all conditions must apply; in an OR group one is enough. Groups can be nested, for example: “Enquiry is Purchase AND (financing is unclear OR equity is empty)”. Write such rules out in plain language before building them. If you cannot phrase a sentence without brackets, the rule is probably too complex and should be split.

Actions: what a rule can trigger

The second half of every rule is the action. Ankerform offers actions at field, step and form level:

  • show / hide: display or hide fields or sections
  • require / optional: make a field mandatory or lift the requirement
  • enable / disable: make a field editable or lock it
  • set_value: set a value automatically, such as a category or a calculated figure
  • skip_step: skip an entire step in multi-step forms
  • end_form: end the form early if an enquiry does not fit
  • completion_page: show a different completion page depending on the answers
  • redirect: forward to a specific page after submission

The first four actions change the form while it is being filled in; the rest control the flow. skip_step and completion_page in particular are often underused: a step that is irrelevant to someone should not appear at all, rather than as an empty page full of hidden fields.

Plan rules before you build them

Most problems with conditional logic do not originate in the tool but in planning. Before creating your first rule, a simple overview on paper or in a spreadsheet pays off.

  1. Name the cases: which types of people fill in the form? For a property enquiry, for example, prospective buyers, prospective tenants and owners.
  2. Define the required information per case: what do you really need to take the next step?
  3. Identify the branching questions: which one or two questions separate the cases? These belong at the start.
  4. Group shared fields: contact details and consents apply to everyone and need no rule.
  5. Write the rules: record the sections, steps and completion pages for each case.

This overview later becomes your documentation. Whoever adjusts the form a year from now will see immediately why a field only appears under certain conditions.

Three practical examples

General property enquiry

The first question is “What is this about?” with the options Buy, Rent, Sell and Let. For Buy and Rent, a search profile step is shown; for Sell and Let, a step with property details. Anyone choosing “Sell” also sees a question about a preferred valuation appointment. The completion page differs by enquiry type and names the relevant next step.

Pre-qualifying prospective tenants

For a rental enquiry on a specific property, a formula can calculate the ratio of total rent to stated income. If it exceeds a threshold you define, set_value sets an internal field “Review needed”. The form looks the same to the applicant, but you see the note directly on the lead. Importantly, rules like this should not reject automatically; they should make your review easier.

Ending unsuitable enquiries early

If you only operate in certain regions, a postcode condition with end_form can end the form and explain politely on a dedicated completion page why you cannot help. That saves the enquirer time and saves you writing a rejection email.

Common mistakes and how to avoid them

MistakeConsequenceBetter
Conflicting rules on the same fieldField flickers or is unexpectedly invisibleOne responsible rule per field; bundle conditions in a group
Required field in a hidden sectionForm apparently cannot be submittedUse require only together with show
Branching question near the endPeople fill in irrelevant fields firstPut deciding questions first
Free text as a conditionTypos break rulesUse choice fields for anything rules react to
No tests per caseErrors surface only with real enquiriesRun through every case once in full

The fourth point is often overlooked. Rules should react to values you control: choice fields, yes/no questions, numbers, dates. A free-text “Enquiry” field is convenient for people but unreliable for rules.

Logic and data quality in the CRM

Conditional logic affects not only the form but also the data that ends up in the CRM. If a prospective buyer later changes her enquiry from “Buy” to “Rent”, purchase budget details should not silently remain on the record. Specify that values from hidden fields are discarded on submission unless you deliberately want to keep them. That way you avoid contradictory records in which one person has both a maximum rent and a purchase price range.

set_value is equally useful for fields needed only internally. A hidden “Lead type” field set automatically from the branching question makes later evaluation and workflows much simpler. A workflow can then react to “Lead type = Owner” instead of evaluating several answers itself. The logic lives in one place, and form and automation speak the same language.

  • Name internal fields clearly and do not display them in the form.
  • Set values that workflows react to only from fixed choice lists.
  • When changing a choice list, check which rules and workflows use the old value.

Testing and maintenance

Create a test run for each case in your plan and fill in the form completely. Check not only whether the right fields appear but also what arrives in the CRM: are hidden fields really empty? Does the lead land in the right column with the right category? Also change an earlier answer halfway through to see whether the form reverts correctly.

When you extend a form later, follow the same order: update the planning overview first, then the rules. Forms are stored with versions, so submissions already received match the form version they were made with.

Conclusion

Conditional logic is not an end in itself. It pays off where different people need to provide different information. Plan the cases first, keep each rule simple, put branching questions at the start and test every path. You will end up with forms that feel short for everyone and still capture everything you need to process the enquiry.

Put it into practice in Ankerform

This article is for general information and is not legal advice.

Curved spiral staircase inside an exposed concrete building

Ready for structured processes?

Try free for 7 days with a template.