# Selection options in letter

**URL:** <https://community.silverfin.com/t/selection-options-in-letter/1329>\
**Category:** Templates\
**Tags:** input, attribute\_boolean\
**Created:** [December 21, 2018, 1:50pm UTC](https://community.silverfin.com/t/selection-options-in-letter/1329 "2018-12-21T13:50:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marie](https://avatars.discourse-cdn.com/v4/letter/m/bc8723/32.png) [@Marie](https://community.silverfin.com/u/Marie)\
**Post date:** [December 21, 2018, 1:50pm UTC](https://community.silverfin.com/t/selection-options-in-letter/1329/1 "2018-12-21T13:50:54Z")

</div>

I try to make a letter with different options.  
If the users selects opdracht3, he must be obliged to check at least one of the 3 inputs below ie opdracht3A, 3B or 3C.  
When opdracht3 is not checked, the user shouldn’t be able to select one of the 3 inputs belowed (these should be blocked)  
These fields (3A, 3B, 3C) should indent a little. When I try this with “-”, the 3 other selection options also indent, what’s not the ame.

Thanks!

```auto

{% inputcomment %}
Kiezen:

{% input custom.artikels.opdracht as boolean %}	Het nazicht van de boekhoudkundige verwerking verricht door de cliënt 
{% input custom.artikels.opdracht2 as boolean %}	Het voeren van de boekhouding 
{% input custom.artikels.opdracht3 as boolean %}	Het opmaken van de jaarrekening met uitsluitingen
{% input custom.artikels.opdracht3A as boolean %} uitsluiting van: nazicht debiteuren
{% input custom.artikels.opdracht3B as boolean %} uitsluiting van: nazicht crediteuren
{% input custom.artikels.opdracht3C as boolean %} uitsluiting van: nazicht voorraad
{% input custom.artikels.opdracht4 as boolean %}	Het opmaken van de jaarrekening zonder uitsluitingen
{% input custom.artikels.opdracht5 as boolean %}	Het opmaken van de fiscale aangifte
{% input custom.artikels.opdracht6 as boolean %}	Herhaaldelijk niet betalen BTW

{% endinputcomment %}

```

---

<div class="post-metadata">

**Author:** ![sven](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/sven/32/1495_2.png) [@sven](https://community.silverfin.com/u/sven)\
**Post date:** [December 21, 2018, 2:16pm UTC](https://community.silverfin.com/t/selection-options-in-letter/1329/2 "2018-12-21T14:16:38Z")

</div>

Hey @Marie,

Please post your code between the so-called tildes, so it has a nice view and easy for us to copy paste 🙂 (I’ve done it now for you in your original post).

What you’re looking for is this:

```auto
{% capture head_table %}|---05%----|------+{% endcapture %}
{% capture sub_table %}|---05%----|---05%----|------+{% endcapture %}

{% assign count_check_3 = 0 %}

{% stripnewlines %}
{{ head_table }}
{% newline %}
| {% input custom.artikels.opdracht as boolean %}	
| Het nazicht van de boekhoudkundige verwerking verricht door de cliënt
{% newline %}
| {% input custom.artikels.opdracht2 as boolean %}
| Het voeren van de boekhouding
{% newline %}
| {% input custom.artikels.opdracht3 as boolean %}
| Het opmaken van de jaarrekening met uitsluitingen
{% if custom.artikels.opdracht3 == true %}
  {% capture extra_3_checks %}
    {% newline %}
    | &nbsp;
    | {% input custom.artikels.opdracht3A as boolean %}
    | uitsluiting van: nazicht debiteuren
    {% comment %}count when marked, to see if we have at least 1 check done{% endcomment %}
    {% if custom.artikels.opdracht3A == true %}
      {% assign count_check_3 = count_check_3 | plus:1 %}
    {% endif %}
    {% newline %}
    | &nbsp;    
    | {% input custom.artikels.opdracht3B as boolean %}
    | uitsluiting van: nazicht crediteuren
    {% comment %}count when marked, to see if we have at least 1 check done{% endcomment %}
    {% if custom.artikels.opdracht3B == true %}
      {% assign count_check_3 = count_check_3 | plus:1 %}
    {% endif %}
    {% newline %}
    | &nbsp;    
    | {% input custom.artikels.opdracht3C as boolean %}
    | uitsluiting van: nazicht voorraad
    {% comment %}count when marked, to see if we have at least 1 check done{% endcomment %}
    {% if custom.artikels.opdracht3C == true %}
      {% assign count_check_3 = count_check_3 | plus:1 %}
    {% endif %}    
  {% endcapture %}
  {% comment %}show warning when less than 1 check has been done{% endcomment %}
  {% if count_check_3 < 1 %}
    {% ic %}{::warningtext}Please select at least 3 checks{:/warningtext}{% endic %}
  {% endif %}
  {% comment %}show the checks{% endcomment %}
{% newline %}
{% newline %}
{{ sub_table }}
{{ extra_3_checks }}
{% newline %}
{% newline %}
{{ head_table }}
{% endif %}
{% newline %}
| {% input custom.artikels.opdracht4 as boolean %}
| Het opmaken van ... 
{% endstripnewlines %}

```

The tricky part is that to display the warning that less than 1 check has been done, you’ll need to capture the 3 checks first, and count with a variable for each check that is done.  
When there’s less than 1, show a warning, and only then show your capture.

Creating local variables is only possible from top to bottom.

Let me know if this works for you. Here’s the output:  
 ![13](https://canada1.discourse-cdn.com/flex030/uploads/getsilverfin/original/1X/290645c5158f1263b9398989bccfce11a5ac0f02.png)
