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.
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:
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;