# Custom Element using data from a collection

**URL:** <https://forum.wixstudio.com/t/custom-element-using-data-from-a-collection/26396>\
**Category:** Ask the community\
**Tags:** code, question\
**Created:** [November 19, 2020, 10:44am UTC](https://forum.wixstudio.com/t/custom-element-using-data-from-a-collection/26396 "2020-11-19T10:44:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bakieness](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/bakieness/32/8068_2.png) [@bakieness](https://forum.wixstudio.com/u/bakieness)\
**Post date:** [November 19, 2020, 10:44am UTC](https://forum.wixstudio.com/t/custom-element-using-data-from-a-collection/26396/1 "2020-11-19T10:44:29Z")

</div>

How do you connect a custom element to data from a collection?

On the support page [(https://support.wix.com/en/article/custom-element-faqs)](https://support.wix.com/en/article/custom-element-faqs) its says the following:

```
'Can I Connect Custom Elements to Data in a Collection? 
Yes, you can connect custom elements to collections using Corvid's [Data](https://www.wix.com/corvid/reference/wix-data.html) and [Dataset](https://www.wix.com/corvid/reference/wix-dataset.html) APIs.' 

```

I couldn’t figure out how it works.

---

<div class="post-metadata">

**Author:** ![yisrael-wix](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/yisrael-wix/32/1107_2.png) [@yisrael-wix](https://forum.wixstudio.com/u/yisrael-wix)\
**Post date:** [November 19, 2020, 11:38am UTC](https://forum.wixstudio.com/t/custom-element-using-data-from-a-collection/26396/2 "2020-11-19T11:38:38Z")

</div>

See the [Dropdown Custom Element](https://www.wix.com/corvid/example/dropdown-custom-element) example which uses the results of a database query to populate a custom dropdown element.

---

<div class="post-metadata">

**Author:** ![bakieness](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/bakieness/32/8068_2.png) [@bakieness](https://forum.wixstudio.com/u/bakieness)\
**Post date:** [November 23, 2020, 10:29am UTC](https://forum.wixstudio.com/t/custom-element-using-data-from-a-collection/26396/3 "2020-11-23T10:29:57Z")

</div>

Ok, the live demo works but when i go to edit the example the preview does not work because it has an async / await function in the custom element.

Also once i chose an option in the drop down how do I get the value in my page file

//Edit  
I have got the dropdown working in preview now. I just need to be able to access the chosen value of the dropdown in the main page file so i can write it to my database
