# Capturing the value of an input field within a collection

**URL:** https://community.weweb.io/t/capturing-the-value-of-an-input-field-within-a-collection/4462
**Category:** Ask us anything
**Created:** [September 20, 2023, 5:11am UTC](https://community.weweb.io/t/capturing-the-value-of-an-input-field-within-a-collection/4462 "2023-09-20T05:11:37Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Cam](https://avatars.discourse-cdn.com/v4/letter/c/bbe5ce/32.png) [@Cam](https://community.weweb.io/u/Cam)
#### Post date: [September 20, 2023, 5:11am UTC](https://community.weweb.io/t/capturing-the-value-of-an-input-field-within-a-collection/4462/1 "2023-09-20T05:11:37Z")

</div>

I have a list of inputs:

![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/6/6efd924639ae866d5b8d84b5b914caef68dbed3d.png)

* * *

Additional info in comments

---

<div class="post-metadata">

### Author: ![Cam](https://avatars.discourse-cdn.com/v4/letter/c/bbe5ce/32.png) [@Cam](https://community.weweb.io/u/Cam)
#### Post date: [September 20, 2023, 5:12am UTC](https://community.weweb.io/t/capturing-the-value-of-an-input-field-within-a-collection/4462/2 "2023-09-20T05:12:22Z")

</div>

I want to use this js on the add icon, so that a value must exist:

![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/1/1e2f7d5792b996fb1773b04f5b52472586a168a1.png)

---

<div class="post-metadata">

### Author: ![Cam](https://avatars.discourse-cdn.com/v4/letter/c/bbe5ce/32.png) [@Cam](https://community.weweb.io/u/Cam)
#### Post date: [September 20, 2023, 5:13am UTC](https://community.weweb.io/t/capturing-the-value-of-an-input-field-within-a-collection/4462/3 "2023-09-20T05:13:02Z")

</div>

I can use this code in the console:

![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/e/ea06ad2c0aadf2eec4dc9fbf35dc4b322941a039.png)

But the error in WeWeb is preventing me from progressing. What should I do? Is there a better way to get the value of an input as it exists inside a list (inside a list)? Thanks!

(I know the console code vs the weweb code does differ slightly, but any variation of trying to get that input’s value is met with the error above)

---

<div class="post-metadata">

### Author: ![dorilama](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dorilama/32/10403_2.png) [@dorilama](https://community.weweb.io/u/dorilama)
#### Post date: [September 20, 2023, 7:02am UTC](https://community.weweb.io/t/capturing-the-value-of-an-input-field-within-a-collection/4462/4 "2023-09-20T07:02:45Z")

</div>

if you want to use js you need to replace `document` with `wwLib.getFrontDocument()`

Anyway it’s not ideal to do this just to get the input value. You can keep track of the value 100% with nocode. See [this example](https://community.weweb.io/t/are-form-variables-not-visible-while-the-form-is-in-a-collection-item/1138/6).

---

<div class="post-metadata">

### Author: ![Broberto](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/broberto/32/5918_2.png) [@Broberto](https://community.weweb.io/u/Broberto)
#### Post date: [September 20, 2023, 7:17am UTC](https://community.weweb.io/t/capturing-the-value-of-an-input-field-within-a-collection/4462/5 "2023-09-20T07:17:51Z")

</div>

You should not do this with Javascript, you’re risking it will break the underlying VueJS logic. Look up @dorilama’s tutorials on how to do this properly, it will save you way too much time.

---

<div class="post-metadata">

### Author: ![Cam](https://avatars.discourse-cdn.com/v4/letter/c/bbe5ce/32.png) [@Cam](https://community.weweb.io/u/Cam)
#### Post date: [September 25, 2023, 6:39am UTC](https://community.weweb.io/t/capturing-the-value-of-an-input-field-within-a-collection/4462/6 "2023-09-25T06:39:34Z")

</div>

Thanks, this helped a ton.
