# Code to submit database field to 2 input elements

**URL:** <https://forum.wixstudio.com/t/code-to-submit-database-field-to-2-input-elements/60565>\
**Category:** Ask the community\
**Tags:** wix-forms, wix-studio, code, question\
**Created:** [July 6, 2024, 10:02pm UTC](https://forum.wixstudio.com/t/code-to-submit-database-field-to-2-input-elements/60565 "2024-07-06T22:02:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![misterwanderluster](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/misterwanderluster/32/13671_2.png) [@misterwanderluster](https://forum.wixstudio.com/u/misterwanderluster)\
**Post date:** [July 6, 2024, 10:02pm UTC](https://forum.wixstudio.com/t/code-to-submit-database-field-to-2-input-elements/60565/1 "2024-07-06T22:02:18Z")

</div>

**Question:**  
I have the below code on my website, that adds database content to input elements. It works in this setup:

const currentItem = $w(“#dynamicDataset”).getCurrentItem();  
$w(“#input22”).value = currentItem.\_id;  
$w(“#input36”).value = currentItem.itinerary;

It works, but now I need to enter the “currentItem.\_id” not only to #input22, but also to #input37. The reason that I have to add it to another input element, is that I have 2 forms on my page that need to process the \_id individually. I tried to add the below line but than the entire code doesn’t work anymore:

$w(“#input37”).value = currentItem.\_id;

Can anybody help me rebuilding the code so I can add the currentItem\_id to 2 text elements on the same page?

Thanks in advance!

**Product:**  
Wix Studio

---

<div class="post-metadata">

**Author:** ![Pratham](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/pratham/32/119586_2.png) [@Pratham](https://forum.wixstudio.com/u/Pratham)\
**Post date:** [July 7, 2024, 11:59am UTC](https://forum.wixstudio.com/t/code-to-submit-database-field-to-2-input-elements/60565/2 "2024-07-07T11:59:48Z")

</div>

Well, technically if you’re able to insert the ID in input22, you should very much be able to insert it in input37 as well.

The fact that you’re not able to - may be due to a logical error.

That is, you might have written this:

> [@misterwanderluster](#):
>
> $w(“#input37”).value = currentItem.\_id;

outside the scope brackets. So try writing this line immediately below the other code, for example:

```javascript
const currentItem = $w(“#dynamicDataset”).getCurrentItem();
$w(“#input22”).value = currentItem._id;
$w(“#input37”).value = currentItem._id;
$w(“#input36”).value = currentItem.itinerary;

```

Also make sure you’re written this code inside the **onDatasetReady** function. Using **await** is recommended.

If it still does not work, try checking the settings of input37 and make sure it is **not** set to _Read Only_.
