Conditional Logic
Make your forms dynamic with conditional logic. Show or hide fields, skip sections, and create intelligent workflows based on user responses.
Understanding Conditional Logic
What is Conditional Logic?
Rules that control form behavior based on user input:
- Show/hide fields dynamically
- Make fields required conditionally
- Skip irrelevant sections
- Calculate values automatically
- Guide users through complex processes
Benefits
- Simplified forms: Only show relevant fields
- Better data: Context-appropriate validation
- Improved UX: Guided experience
- Fewer errors: Smart validation
- Faster completion: Skip unnecessary sections
Basic Conditions
Show/Hide Fields
Simple Example
Show damage details only when damage is found:
IF "Damage Found" = "Yes"
THEN Show "Damage Description"
Setting Up
- Select field to control
- Click Logic icon
- Choose "Show when"
- Set condition
- Save rule
Required Fields
Make fields required based on conditions:
IF "Priority" = "Emergency"
THEN "Contact Phone" is Required
Field Values
Set values based on other fields:
IF "Service Type" = "Warranty"
THEN "Cost" = 0
Condition Types
Comparison Operators
Equals
"Status" equals "Active"
"Count" equals 5
"Has Insurance" equals "Yes"
Not Equals
"Type" not equals "Standard"
"Priority" not equals "Low"
Greater/Less Than
"Age" greater than 18
"Score" less than 70
"Temperature" greater than or equal to 100
Contains
"Description" contains "urgent"
"Email" contains "@company.com"
Is Empty/Not Empty
"Notes" is not empty
"Reference Number" is empty
Complex Logic
Multiple Conditions (AND)
All conditions must be true:
IF "Equipment Type" = "HVAC"
AND "Age" > 10
AND "Last Service" > 6 months ago
THEN Show "Replacement Recommendation"
Alternative Conditions (OR)
Any condition can be true:
IF "Priority" = "Emergency"
OR "Customer Type" = "VIP"
OR "Contract" = "Premium"
THEN Show "Expedited Service"
Nested Conditions
Conditions within conditions:
IF "Service Type" = "Repair"
IF "Under Warranty" = "Yes"
Show "Warranty Claim Number"
ELSE
Show "Payment Method"
Common Patterns
Progressive Disclosure
Reveal fields step by step:
1. "Issue Type" = "Electrical"
→ Show "Electrical Details"
2. "Electrical Details" = "No Power"
→ Show "Breaker Check"
3. "Breaker Check" = "Tripped"
→ Show "Reset Instructions"
Skip Logic
Jump to relevant sections:
IF "New Customer" = "Yes"
Skip to "Customer Information"
ELSE
Skip to "Service Details"
Validation Rules
Context-aware validation:
IF "Payment Type" = "Credit Card"
"Card Number" must be 16 digits
"CVV" must be 3 digits
"Expiry" must be future date
Calculations
Dynamic value computation:
"Total Cost" =
IF "Customer Type" = "Member"
("Parts" + "Labor") * 0.9 // 10% discount
ELSE
"Parts" + "Labor"
Field Dependencies
Cascading Dropdowns
Filter options based on selection:
"State" = "California"
→ "City" shows only CA cities
"Equipment Type" = "HVAC"
→ "Model" shows only HVAC models
Linked Validations
Validate related fields:
"End Date" must be after "Start Date"
"Confirm Email" must equal "Email"
"Max Value" must be greater than "Min Value"
Advanced Logic
Date-Based Logic
Time-sensitive conditions:
IF Today - "Installation Date" > 365 days
THEN Show "Annual Maintenance Due"
IF "Appointment Date" < Today + 24 hours
THEN "Urgent" = True
User Role Logic
Different fields for different users:
IF User Role = "Technician"
Show "Technical Details"
IF User Role = "Customer"
Hide "Internal Notes"
Location-Based Logic
GPS-triggered conditions:
IF Distance from "Asset Location" > 50 miles
THEN Show "Travel Charge"
IF Current Location = "Restricted Area"
THEN Require "Access Permit Number"
Building Logic
Step-by-Step Process
-
Plan Your Logic
- Map out conditions
- Identify dependencies
- Consider all paths
-
Start Simple
- Build basic rules first
- Test each condition
- Add complexity gradually
-
Test Thoroughly
- Try all scenarios
- Check edge cases
- Verify on mobile
Logic Builder Interface
Visual Builder
- Drag-and-drop conditions
- Connect with AND/OR
- See flow diagram
- Test in real-time
Formula Editor
For complex logic:
if (field1.value === "A" && field2.value > 10) {
field3.show();
field3.required = true;
} else {
field3.hide();
}
Best Practices
Keep It Simple
- Don't over-complicate
- Clear condition names
- Logical grouping
- Document complex rules
Performance
- Limit nested depth
- Optimize calculations
- Test on mobile
- Monitor load times
User Experience
- Smooth transitions
- Clear indicators
- Helpful messages
- Logical flow
Maintenance
- Name rules clearly
- Document purpose
- Regular reviews
- Update as needed
Examples
Equipment Inspection
IF "Equipment Type" = "Vehicle"
Show "Mileage"
Show "License Plate"
Hide "Serial Number"
IF "Mileage" > 50000
Show "High Mileage Checks"
Require "Oil Change Date"
Service Request
IF "Service Type" = "Emergency"
Require "Contact Phone"
Show "Alternate Contact"
Set "Priority" = "High"
Send notification immediately
ELSE IF "Service Type" = "Scheduled"
Show "Preferred Date"
Show "Time Window"
Calculate "Due Date" = Today + 7 days
Dynamic Pricing
Base Price = 100
IF "Customer Type" = "New"
Discount = 20%
ELSE IF "Contract" = "Gold"
Discount = 15%
ELSE
Discount = 0%
IF "After Hours" = "Yes"
Surcharge = 50
Total = (Base Price - Discount) + Surcharge
Troubleshooting
Logic Not Working
- Check field names
- Verify operators
- Test conditions
- Review dependencies
Performance Issues
- Simplify complex rules
- Reduce calculations
- Optimize conditions
- Cache results
User Confusion
- Add help text
- Show why hidden
- Clear error messages
- Progressive disclosure