Hello!
I am creating a Dropdown for a client that is linked to a database.
In the database I have a Title and a Docmuent. When they select a Title in the Dropdown I need it to go directly (with or without a Go button) to the Document, in a new window preferably.
Is this possible?
Thanks!
I think you can try setting an “if” condition for each value of your dropdown item to go to the related document on wix.Location; under your dropdown’s onChange event.
Should look something like this:
import wixData from 'wix-data';
import wixLocation from 'wix-location';
//with go button:
export function gobutton_click() {
if ($w("#yourdropdown").value) ==='title1' {
wixLocation.to("wix:document://yourdocument1")
($w("#yourdropdown").value) ==='title2' {
wixLocation.to("wix:document://yourdocument1")
//more if conditions for each dropdown value
}
}
}
//without go button:
export function yourdropdown_change() {
if ($w("#yourdropdown").value) ==='title1' {
wixLocation.to("wix:document://yourdocument1")
($w("#yourdropdown").value) ==='title2' {
wixLocation.to("wix:document://yourdocument2")
//more if conditions for each dropdown value
}
}
}
// mind the difference between ' and `
Check out this page to see how you can redirect to a document using wixLocation
**This is my amateur approach on solving your problem and i’m just trying to help… i’m sure there is a professional solution for this. 