Conditional Logic & Dynamic Behavior

Build smart forms that adapt to user input in real time — show and hide fields, skip form steps, and create guided experiences without writing a single line of code

Conditional logic transforms static forms into dynamic, conversational experiences. Instead of showing every field to every user, WebForms displays only what is relevant — reducing form length, eliminating confusion, and increasing completion rates.

Native Magento 2 has no built-in conditional logic for custom forms. WebForms adds a complete visual rule engine that works with any field type, supports multi-step forms, handles 100+ rules efficiently, and requires zero custom development.

12
Features
4
Categories
100+
Rules Supported
0
Lines of Code

Visual Rule Builder

Build conditional rules through a point-and-click admin interface — no code, no custom development. The visual builder lets you define conditions and actions that control how your form adapts to user input.

Suite

Conditional Logic Rules Engine

A visual if/then rule builder in the Magento admin panel. Select a trigger field, set a condition (equals, not equals, contains, is empty), and choose the action — show or hide target fields. No coding required. Rules are stored per form and applied automatically on the frontend.

Suite

Multiple Trigger Conditions

Combine multiple conditions using AND/OR logic within a single rule. For example: show the "Company Details" fieldset only when Type = "Business" AND Country = "United States". Complex branching scenarios become a single rule instead of a chain of workarounds.

Suite

All Field Types as Triggers

Use any selectable field type as a trigger: dropdowns, radio buttons, checkboxes, and multiselects. Text fields can trigger rules based on whether they are empty or contain a specific value. This means any user choice on the form can drive visibility of other fields.

Visibility Controls

Control exactly what the user sees at any given moment. Hide irrelevant fields, skip entire form steps, and show contextual instructions — all driven by the user's own answers.

Suite

Show/Hide Fields Based on Selection

The core conditional action: when a trigger field matches a condition, target fields instantly appear or disappear. The transition is animated for a smooth experience. Hidden fields are removed from the DOM entirely — they don't submit values and don't count toward validation, so users never hit errors on fields they can't see.

Suite

Show/Hide Entire Form Steps

In multi-step forms, entire pages can be shown or skipped based on prior answers. If a user selects "Individual" instead of "Business", the company details step is skipped automatically. The progress indicator updates in real time to reflect the actual number of visible steps, so users always see an accurate representation of the form length.

Suite

Custom HTML Block Visibility

HTML content blocks — instructional text, warnings, embedded media, section headings — can be conditionally shown or hidden just like input fields. Display a "Tax ID required" notice only when the user selects "Business", or show additional instructions only when a specific option is chosen. This turns static forms into contextual, guided experiences.

Suite

Server-Side Validation of Hidden Fields

Fields hidden by conditional rules are automatically excluded from server-side validation. If a field is marked as required but is currently hidden, the form submits without error. This happens automatically — no manual configuration needed. The server validates only what the user can actually see and interact with.

Dynamic Form Behavior

Forms that respond instantly to user input — no page reloads, no delays. Fields appear and disappear in real time as users fill out the form, creating a guided experience that reduces confusion and form abandonment.

Suite

Real-Time Form Adaptation

All conditional rules execute client-side in JavaScript with zero server round-trips. When a user changes a dropdown selection or checks a box, dependent fields appear or hide instantly. The form layout adjusts smoothly without flicker, maintaining scroll position and focus state. Users experience the form as a responsive conversation, not a static document.

Suite

Cascading Rule Chains

Rules can cascade: Field A shows Field B, and Field B shows Field C. When Field A changes, the entire chain re-evaluates. If the user changes Field A to hide Field B, Field C also hides automatically. Circular dependencies are detected and prevented at configuration time, so cascading chains always resolve cleanly.

Suite

Conditional Value Reset

When a field is hidden by a conditional rule, its value can optionally be cleared. This prevents stale data from a previous form state from being submitted. For example, if a user initially selects "Other" and types a custom value, then switches back to a predefined option, the custom text field resets instead of silently submitting the leftover value.

Performance & Scalability

WebForms conditional logic is engineered for complex, real-world forms — not just simple demos. The rule engine handles hundreds of conditions without degrading the user experience.

Suite

Optimized for 100+ Rules

The rule evaluation engine is built to handle forms with over 100 conditional rules without noticeable delay. Rules are compiled into an efficient dependency graph at page load, so evaluation on each user interaction checks only the affected rules — not all of them. This architecture keeps complex enterprise forms responsive even on lower-end devices.

Suite

Faster Processing Engine

The conditional logic processor has been optimized to evaluate complex rule sets multiple times faster than earlier implementations. Batch evaluation reduces DOM updates — instead of toggling fields one by one, all visibility changes from a single user action are calculated first and applied in one pass, eliminating layout thrashing.

Real-World Examples

Concrete conditional logic patterns that work out of the box. Each example shows the trigger, the condition, and the resulting form behavior.

Contact Form with Department Routing

User selects "Subject" — fields change based on selection

  • When Subject = "Technical Support" — show "Product Version" and "Error Message" fields
  • When Subject = "Billing" — show "Invoice Number" field
  • When Subject = "Partnership" — show "Company Name" and "Website" fields

Multi-Step Registration Form

Individual vs Business registration with different steps

  • When Account Type = "Business" — show Step 2: "Company Details" (Tax ID, Company Name, Industry)
  • When Account Type = "Individual" — skip Step 2, go directly to Step 3: "Preferences"
  • When Country = "EU member state" — show "VAT Number" field in billing step

Product Customization Form

Options expand based on product configuration choices

  • When Material = "Custom" — show "Upload Your Design" file field
  • When Size = "Other" — show "Custom Dimensions" text fields (width and height)
  • When Gift Wrapping = "Yes" — show "Gift Message" textarea and "Delivery Date" picker

Service Request Form

Progressive disclosure based on urgency and service type

  • When Priority = "Critical" — show "Preferred Callback Time" and phone number becomes required
  • When Service Type = "On-Site" — show "Location Address" and Google Maps picker fields
  • When "Attach Documentation" checkbox is checked — show Dropzone file upload field

WebForms vs Native Magento

Magento 2 out of the box has no conditional logic for custom forms. Here is what you gain with WebForms.

Native Magento 2
  • No conditional field visibility
  • No show/hide based on user input
  • No multi-step form logic
  • No visual rule builder
  • Custom development required
WebForms Suite
  • Show/hide any field type
  • AND/OR conditions with cascading
  • Skip entire form steps
  • Visual drag-and-drop rule builder
  • Zero code — configure in admin panel
  • 100+ rules with optimized engine

Frequently Asked Questions

What is conditional logic in Magento 2 forms?

Conditional logic allows form fields to appear or hide dynamically based on user input. When a visitor selects an option in one field, other fields become visible or hidden in real time — no page reload required. In WebForms, you configure these rules through a visual admin interface without writing any code.

How do I show or hide fields based on a dropdown selection?

In the WebForms form editor, create a new conditional rule. Select the dropdown field as the trigger, set the condition (e.g., "equals" + the specific option value), and choose which fields to show or hide. Save the form, and the rule takes effect immediately on the frontend. No code or template changes needed.

Can conditional logic skip entire steps in a multi-step form?

Yes. Conditional rules can target entire form steps, not just individual fields. When a condition is met, the step is either shown or skipped. The progress indicator updates automatically to reflect the actual number of visible steps, so users always see an accurate representation of where they are in the form.

How many conditional rules can WebForms handle?

WebForms is tested and optimized for forms with over 100 conditional rules. The engine compiles rules into a dependency graph at page load and evaluates only affected rules on each interaction, so performance scales well even with complex logic. Enterprise forms with extensive branching work without noticeable delay.

What happens to hidden fields during form submission?

Fields hidden by conditional rules are excluded from both client-side and server-side validation. Required fields that are currently hidden will not block submission. Hidden field values are not submitted, preventing stale data from previous form states from being included. This behavior is automatic — no additional configuration needed.

Does conditional logic work with all WebForms field types?

Conditional rules can target any field type — text inputs, textareas, file uploads, date pickers, HTML blocks, and more. Trigger fields must be selectable types (dropdowns, radio buttons, checkboxes) or text fields with empty/not-empty conditions. The show/hide action works the same regardless of the target field type.

How does WebForms conditional logic compare to native Magento?

Native Magento has no built-in conditional logic for custom forms. Magento's product custom options support basic dependent dropdowns, but there is no way to show or hide fields, skip form steps, or build if/then rules for contact forms, registration forms, or any other frontend form. WebForms adds a full visual rule engine with AND/OR conditions, cascading chains, multi-step support, and performance optimization — capabilities that would otherwise require custom development.

Can I create dependent form fields in Magento 2?

Yes, with WebForms. Dependent fields — where one field's visibility depends on another field's value — are the core use case for WebForms conditional logic. You define the dependency in the admin panel: select the parent field, the trigger value, and the dependent fields. Multiple levels of dependency (A → B → C) are supported through cascading rule chains.

Smart Forms That Adapt to Every User

Stop showing 30 fields when 10 will do. Conditional logic reduces abandonment and improves data quality.

100+
Rules per Form
0
Lines of Code
3
Theme Frameworks