Dynamic page collection data submitted with form submission data

I’m having trouble with
On my dynamic item page I have a form to request the shown item. I cannot submit the ID or URL from the dynamic page to know what the request was made for. Any code to get the URL and submit it with the form has not worked.

Working in
e.g. Wix Studio Editor, Wix Velo

Site link
Any item from the collection such as this one: https://teresabrouwers.wixstudio.com/privatehomes/properties/seltenheit-in-alsternhe-473

What I’m trying to do
Have the item ID or any collection data submitted with the form on the dynamic item page.

What I’ve tried so far
ChatGPT and Wix AI Code snippets that would draw data either from the dataset collection or the URL and insert it in a hidden form field.

If AI suggestions didn’t work, always make sure to look it up on the forum first before creating a post of your own because there are high chances that people have faced the same problem before and have already found a solution.

Here’s a great detailed tutorial that shows you how to do it:

1 Like

Hey Pratham,

this was exactly the AI suggestion - but for me this doesn’t work unfortunately. I have tried many times and talked to the support for hours, but nothing gets shown in the submissions hidden field.

This is the code I’ve used:

$w.onReady(function () {

    $w("#properties").onReady(() => {

let itemObj = $w("#properties").getCurrentItem();




let currentPage = itemObj["urlSlug"];




$w("#form1").setFieldValues({

url_slug: currentPage

});

});

});

Where properties is the ID of my dynamic dataset;

urlSlug the ID of the URL slug extracted from the dynamic dataset;

form1 the form ID;

url_slug the ID of the hidden form field

All looks correct :slight_smile:

Double check you’ve published the site after making all of the changes, and are testing in the live site for it to work

1 Like