Stay tuned Watch us Facebook Twitter

Thanks! We`ll keep in touch.

Sign up for our Peggy Journal

Get the latest Peggy Forms news, features and great offers!



Conditional logic and rules

With conditional logic and rules you can make your forms dynamic, responding to users input. With very easy step-by-step settings your field rules are set with just a few clicks. You can add as many rules and logicgroups as you need.

With the conditional logic and rules feature your forms are more dynamic and powerful than ever.

Conditional logic and rules - Peggy Forms View example


Are you convinced that Peggy Forms is the online form builder you absolutely need? Are you thrilled to build some amazing powerful forms? Then let us welcome you to the Peggy Family. Just sign yourself up and you're a proud member of it.

Become a proud member of the Peggy Family

How to | basic rules

For example we take the example form.

1. The form

We start with a simple form with 1 choice field and 2 lists:

Example conditional logic - step 1

As you might notice, we made the label of the 2 lists also dynamic. You can see that because the labels have a blue/green background. The labels will have the value of the choice field. So the user choose 'list of strentgh', the label will be also 'list of strength'.

Example conditional logic - step 2 - dynamic labels

2. Fieldrule

Now we add the following rule. We want to show the dropdown List of strength only if we chooose that option in the choice field.
So we start with adding a field-rule that says: show this field when all validationrules validates:

Example conditional logic - step 3 - field rules

3. Validationrules

Then we have to define the validationrule. For this purpose we only need 1 validationrule. Remember that you can add as many field rules and validation rules as you need.
Pick a dependent field and setup the validation rules very easily:

Example conditional logic - step 4 - validation rules

And thats all. We do the same for the dropdown List of speed, and the logic is created.

View this form

How to | advanced rules

1. Survey with advanced rules

Let's say we want the following survey:

Step 1 the form

Of course we don`t want to show all fields. If we choose single or living with parents, we dont need the partner fields. But when we choose living together or married then we need them. The two salary fields needs also some conditions. This will be the most interesting and advanced part. Only if we have a partner and that both of us have a job the combined salary field should appear. Otherwise we show the other salary field. This means that we need a rule that says: show the combined salary field only when field working condition is either fulltime or parttime, and field working condition partner is either fulltime or parttime.

2. The basic rule

So let`s start with the first step: only show the partner fields when we fill in that we have a partner:

Step 2 the first rule

You can see that we defined two validation rules: Marital status equals 'living together' or 'married'. Notice that we set the rule operator to Or.

When you now try the form, you`ll see the field showing and hiding depending on your first choice. You also see that both salary fields always appear. This needs to be fixed.

3. The advanced rules

First select the Combined avarage salary field and make a new field rule. A validation rule is automatic created. Add one validation rule extra with the + button. Set the Rule operator to Or, target both validation rules to the working condition field, set it to equals and choose respectivily fulltime and partime.

Now create another Logic group with the button new logic group below and set the Group operator to And. Make the same validation rules as before, but now targetting the working condition partner field.

Lets name our huge rule by clicking on Field rule name in the top and press Enter:

Step 3 name rule

So if we press the Return button at the top we get this nice overview of our big new rule:

Step 4 overview rule

We might add another logic group with two validation rules that says: show when Marital status is either living together or married. Use And for the group operator and Or for the rule operator.

Step 5 overview rule 2

4. The last steps

Now select the average salary field and click on existing field rule under the Rules tab. Select the Field rule Combined avarage salary and set copy type to make a copy. We need a copy and not a reference because we need to alter the rule a little bit.

Step 6 copy rule

The first thing we are gonna change is the field rules action. Click Edit below the rule overview. Set Show to Hide at the top of the rules panel.

At last we need to get lost of the lowest logic group with the Marital status rules. This one is not needed here, so find the logic group and press Remove this group and confirm. Now press the Return button in the top.

Step 7 final touch

5. The final result

That's it! Now our great survey with advanced validation rules is ready to use.