This what is currently have written
export function functionalmolding_click(event) {
//Add your code for this event here: {
wixLocation.to("https://www.smpco.com/functional-molding",)
}
This what is currently have written
export function functionalmolding_click(event) {
//Add your code for this event here: {
wixLocation.to("https://www.smpco.com/functional-molding",)
}
Add in import statement to the beginning of your code file:
import wixLocation from 'wix-location';
I did this but the statement immediately greys out in the editor and the code then doesn’t function. If I don’t put this in then I get an error that wixLocations is undefined when I try to reference it using the to property as the original poster above.
Hey Tom,
Copy paste your code here so that we can take a look and see the issue in order to help you out.
Thanks Pratham,
I have resolved the to problem by using
import wixLocationFrontend from “wix-location-frontend”;
at the top of my code and then using
wixLocationFrontend.to(fully qualified link here)
in the body of the code. This code now works as desired.
However I’m now trying to pull one field from the current item on a dynamic page. When the line of code that tries to pull the single field
dbpwout1 = $w(“#ToursItem”).getCurrentItem().Tour-Password;
is uncommented NOTHING works. If I comment it then everything runs but obviously I don’t get the desired result returned, it returns the null I set it to at the beginning of the function. I’ve tried many different avenues to do this, some resulted in imports killing the code. This is the final try that got closest. What am I missing?
Here is an example of the code:
function GetPassword1 (tourID)
{
let dbpwout1 = “”;
TraceMessage(“In GetPassword 1 about to get object”);
dbpwout1 = $w(“#ToursItem”).getCurrentItem().Tour-Password;
TraceMessage("Got the DB Password " + dbpwout1);
return dbpwout1;
} // End GetPassword1 Function