Hello, I've tried several versions of the below code and can't the text block to link to a URL stored in a URL field called "dealer_website"? I have the text block successfully displaying just domain.com and want the click/link to go to https://www.domain.com/
import wixData from "wix-data" import wixLocation from "wix-location" export function website_click(event) { wixLocation.to("dealer_website"); }
![](https://static.wixstatic.com/media/a27d24_6a2c85a795bb4fd89d48d62b545d5425~mv2.png/v1/fill/w_980,h_438,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/a27d24_6a2c85a795bb4fd89d48d62b545d5425~mv2.png)
Sent you a note in FB Messenger
Yes, that worked great...thanks!
export function website_click(event) { let item = $w("#dealersDataset").getCurrentItem(); wixLocation.to(item.dealer_website) }
Sorry, correction... my code:
export function website_click(event) { let item = $w("#dealersDataset").getCurrentItem(); wixLocation.to(item.link)
OK, I used the below code and got the below error code.
let item = $w("#myDataset").getCurrentItem(); wixLocation.to(item.link)
Wix code SDK error: The url parameter that is passed to the to method cannot be set to the value . It must be of type string.
Hi đ
Internal links must start with "/" ... So just add it to your code:
wixLocation.to("/dealer_website")
But from what I can see, this link should by dynamic, and you're not using the right way.
If the link is just a link field in your collection, get the current item from the dataset, and get the item's link:
let item = $w("#myDataset").getCurrentItem(); wixLocation.to(item.link)
And if the link is a link to a dynamic page in your collection, get the current item as above and then access the link by it's field key.
let item = $w("#myDataset").getCurrentItem(); wixLocation.to(item['dataset-link'])
Hope that helped~!
Ahmad