# How to make independent input fields inside a for loop

**URL:** https://community.silverfin.com/t/how-to-make-independent-input-fields-inside-a-for-loop/1990
**Category:** Templates
**Tags:** input-fields, forloop
**Created:** [January 4, 2021, 9:29pm UTC](https://community.silverfin.com/t/how-to-make-independent-input-fields-inside-a-for-loop/1990 "2021-01-04T21:29:18Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Flora](https://avatars.discourse-cdn.com/v4/letter/f/9de0a6/32.png) [@Flora](https://community.silverfin.com/u/Flora)
#### Post date: [January 4, 2021, 9:29pm UTC](https://community.silverfin.com/t/how-to-make-independent-input-fields-inside-a-for-loop/1990/1 "2021-01-04T21:29:19Z")

</div>

Hi there,

Could you please advise how can I make the input fields in the “Comments” and “Attachments” columns independent? I coded those input cells inside the for loop,but when the user select a new account, the comment cells and attachments will be overridden.

Please see the screenshot and coding below:

 ![Forloop coding question](https://canada1.discourse-cdn.com/flex030/uploads/getsilverfin/original/2X/0/09c374b73205efdb7972b136f507875b3431d68d.png)

{% assign additional\_items\_range = additional\_items\_range | default:“1491,1492,1591,1592,2491,2492,2591,25923991,3992” %}

{% stripnewlines %}  
|  
|Account  
|Comments  
|Attachment  
{% newline %}  
|:—3%-----  
|:----25%----  
|:----70%----  
|:—2%-----#{% ic %}{% endic %}+  
{% newline %}  
|{% input custom.additional\_items.toSelect as:account\_collection range:additional\_items\_range accounts\_var:additional\_items | currency\_dc %}  
{% newline %}  
{% for additional in additional\_items %}  
|  
|{% capture additional\_account\_link %}{% linkto additional %}{{ additional.original\_number }} {{ additional.original\_name }}{% endlinkto %}{% endcapture %}  
{{ additional\_account\_link }}  
{{ additional\_account\_name }}  
**| {% input custom.additional.toSelect as:text placeholder:‘Description’ %}**  
**|{% input custom.account\_file.toSelect as:file\_collection %}**  
{% newline %}  
{% endfor %}  
{% endstripnewlines %}

Thank you!

---

<div class="post-metadata">

### Author: ![Michiel](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/michiel/32/2364_2.png) [@Michiel](https://community.silverfin.com/u/Michiel)
#### Post date: [January 4, 2021, 9:39pm UTC](https://community.silverfin.com/t/how-to-make-independent-input-fields-inside-a-for-loop/1990/2 "2021-01-04T21:39:21Z")

</div>

Hi Flora,

The text and file inputs are part of a forloop, so they need to be unique for each loop, if not they will be reproduced every line.

Since you are looping over accounts, I suggest to use the account id as a key.

```auto
{% capture account_id %}{{ additional.id }}{% endcapture %}
|{% input custom.[account_id].toSelect as:text placeholder:‘Description’ %}
|{% input custom.[account_id].File_toSelect as:file_collection %}

```

Furthermore remark that there is no need to use a currencyfilter for an account collection input field.

Kind regards,

Michiel

---

<div class="post-metadata">

### Author: ![Flora](https://avatars.discourse-cdn.com/v4/letter/f/9de0a6/32.png) [@Flora](https://community.silverfin.com/u/Flora)
#### Post date: [January 5, 2021, 1:40pm UTC](https://community.silverfin.com/t/how-to-make-independent-input-fields-inside-a-for-loop/1990/3 "2021-01-05T13:40:58Z")

</div>

Hi Michiel,

This solution works for me, thank you for your help!

Kind regards,
