My goal is to link from a dynamic item page to a specific page on my site, based on an element value on the dynamic page.
On my dynamic page:
1. I’m trying to use a submit button’s event handler option, “onClick:”
2. Coding the function in the Developer’s Console:
export function submitbutton_click() {
//Add your code for this event here:
var storeType = "/"+$w("#input9").value+"-grocery-list"; // Declare var storeType to create needed URL
$w("#submitbutton").link = storeType; // Set "SEE LIST" button to correct store list page URL
}
(The variable “storeType” is derived from another element on the dynamic page which works out to be the needed (local) index page URL, “/Raleys-grocery-list”, for example.)
Challenge: After the submit button is pressed, it updates the Collection as necessary and the submitbutton’s link value is set to the proper URL, but it does not redirect. It just stays on the dynamic page.
I hope I explained that better! Any tips would be appreciated.