Capture a unique identifier (or url) within a form completed on a dynamic page

Hi everyone, I have dynamic pages and would like a way to identify enquiries submitted from those pages. So if a form on a dynamic page is submitted, I know the enquiry is in relation to that particular dynamic page. Does any one know if this can be done, please?

Hello Steve,

what are dynamic pages? Dynamic pages are just reflections of a DATABASE connected by the help of DATASETs.

So for example you have 10-dynamic pages (all of them some kind of forms which have to be filled by users).

So now you wanna know, which of these 10-forms were filled out by user, right?

So if it is like i have described, so you just need have to know the INDEX of the dataset, right?

For example a user fills out the form-page-6 (currentIndex in the DATASET = 5)

So you always know which form was filled out by user, when he submit.

But perhaps i also did not understand your issue.

When you know the INDEX, then you know everything, because you know the whole current Row in the DATABASE, when you do a DATA-Querry.

Hi @russian-dima, thanks for responding. I think you’re on the right lines. I have created a form that produces multiple dynamic pages as you might find with a real estate site. So I would like a user who is viewing that dynamic page (for example the potential buyer interested in the property) to enquire about it any way that would let me know a) email address of person who has enquired and b) on which of the multiple dynamic pages the form is connected to.

A little bit difficult to imagine your site structure. Do you made all without code? So if you want to use codelines, then probably the following code-snipets could probably help you…

let itemIndex = $w("#myDataset").getCurrentItemIndex(); // 3

But i don’t know if that works also on dynamic pages, besause it is alwasy just one page, not sure.

The customer/byer clicks on “OK” or “Submit” or what ever, and boom you have the right/current indexRow in your DATABASE.

Then you take this INDEX and do a DATABASE-QUERY.

import wixData from 'wix-data';

wixData.query("myCollection")
  .find()
  .then( (results) => {
    if(results.items.length > 0) {
      let firstItem = results.items[0]; //see item below
    } else {
      // handle case where no matching items found
    }
  } )
  .catch( (err) => {
    let errorMsg = err;
  } );

After this you should now know the page, which was filled out.

Point-b done!

For point-a you can make a triggered-Email, look here…

…and here …

I have played a little bit for testing my knowledge and did this little example, which works endeed…
https://russian-dima.wixsite.com/wixworld/blank-10

Ok, thanks for your time. I may need to employ some help to get it sorted. It sounds like you’ve got the idea but I’d have difficulty in deploying and testing it. Thanks again.

I can’t see your site-project, so i can not do much.
Perhaps a pic or a part of your site, where i can look at?
So i would try to reconstruct a piece if possible.

Thanks. Example of dynamic page here:
https://www.silversharers.com/property-upload/bd7c84e8-9440-47aa-842c-5cfa9dff16db
Looking for any way possible to allow a user to create a response, via a form, a button, popup or any other way, that allows them to express their interest in enquiring about the room.

If you create a form using code, and submit it to a database, then it’s simple.
You create a field in your referral database, a reference field that is linked to the blog database (of the dynamic pages).
Then in the response form they send you also send the page ID to the reference field.
That’s about the process


import wixData from 'wix-data';
export function button1_click(event, $w) {
let insert ={
 "Comment" : $w('#input1').value,
 "item" : $w('#dynamicDataset').getCurrentItem()._id
}
wixData.insert("Comments", insert)

}

Many thanks AV, I’ll take a look at implementing.