I have a wixData.insert function correctly set up, but I want to use wixLocation.to to go to the inserted item’s dynamic page. I used this code:
(I know that the link to the dynamic page is stored in “link-forum-p-category-title”)
//wixData.insert function ...
.then((results) => {
wixLocation.to(results.items[0].link-forum-p-category-title)
})
But this gives me the following error:
How can I get this to work?
Looks like Wix is taking ‘link-forum-p-category-title’ as seperate items.
Should it not be something like this example here?
let url = results.items[0].id ; wixLocation.to('/yourPath/${url}')
@givemeawhisky I don’t think so. The url of the dynamic page looks like this:
/kaart/Category/Title
And this wouldn’t work:
/yourpath/Id
@GOS
I’m sorry but could you help me with this? I am planning to release the update of my site before Monday…
Yes I know that sample would not work as you had to change it to suit your own site.
You are trying to do something like this?
//https://yourwebsite/kaart/Category/{link-forum-p-category-title}
No, my dynamic page has a web address which is /kaart/{Category}/{Title}. That’s the same as {link-forum-p-category-title}, because a database always saves the address of the corresponding dynamic page.
@givemeawhisky I managed to get it to (partially) work.
.then((results) => {
wixLocation.to('/kaart/' + $w("#category").value + "/" + $w("#title").value)
})
The problem with this code is, that when there are any special characters in the URL, it doesn’t work.