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!



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.


Continue reading