Question:
I can not figure out how to get the EventDetails when I am working on the Event Details page. I want be able to create a custom butten that uses the value that is in the Event Details Location Name field when you create the event through the UI.
I can’t figure out how to access that information. Any one got a code example? I am trying to use Velo and I see the wix-events.v2, but it always requires the eventID to get the object. I don’t know how to get the eventID from the current page being displayed. All the examples show a hardcode event title search.
Product:
The latest wix edition, i think.
What are you trying to achieve:
I am trying to get the LocationName field from the Events Data in order to populate the custom Button I put on the Events Detail pages. This button is to use the url I put in the LocationName field when filling out the event.
What have you already tried:
[
import wixData from ‘wix-data’;
import { local } from ‘wix-storage’;
import { wixEventsV2 } from ‘wix-events.v2’;
$w.onReady(function () {
// Write your Javascript code here using the Velo framework API
// Print hello world:
// console.log("Hello world!");
// Call functions on page elements, e.g.:
// $w("#button1").label = "Click me!";
// Click "Run", or Preview your site, to execute your code
console.trace("On Run Started" );
const myeventpromise = wixEventsV2.findEvent();
console.trace("what the heck");
wixData.query(“Events/Events”)
.find()
.then( (results) => {
// handle the results
console.trace(“got wix data” + results.items[0].l);
} );
$w("#button27").link = "http://www.openfinity.org";
});
/**
- Adds an event handler that runs when the element is clicked.
Read more - @param {$w.MouseEvent} event
*/
export function button27_click(event) {
// This function was added from the Properties & Events panel. To learn more, visit Working with the Properties & Events Panel
// Add your code for this event here:
}
Additional information: