Unable to get Dropdown Value Inside a Repeater

I have a simple repeater that contains a dropdown box for selecting a category. The category and the number will be passed as session variable to open a lightbox slide show of photos.

In the following code I DO GET the roundup number but am unable to get the category value selected? I thought the dropdown was maybe not connected to the repeater item so I dragged it outside the repeater, then back into the repeater item and saw the blue notice “Attache to Item”. I originally tried to get the value inside the viewPhotos event, when that didn’t work I created an “onchange” event for the dropdown.

Here is the code:
import wixData from ‘wix-data’;
import wixWindow from ‘wix-window’;
import wixLocation from ‘wix-location’;
import wixUsers from ‘wix-users’;
import { session } from ‘wix-storage’;
import {local} from ‘wix-storage’;

let category;

$w.onReady(function () {
//TODO: write your page related code here…

});

export function viewPhotos_click(event,$w) {
let roundup = $w(‘#ruNum’).text;
console.log("roundup: ", roundup)
session.setItem(“Category”, category);
session.setItem(“Roundup”, roundup);
// wixWindow.openLightbox(‘Roundup Photos’, $w(‘#dataset7’).getCurrentItem())
}

export function category_change(event) {
category = $w(‘#category’).value;
console.log("category: ", category)
}

HERE is a screenshot of what happens:

What am I doing wrong?
Thanks
JD

I just found a wix example at:
https://editor.wix.com/html/editor/web/renderer/new?siteId=453492f7-fd79-42b7-8478-cf6a85325e3a&metaSiteId=05c3ba71-15cd-4f5d-a503-ce8ce4af7eff

But unfortunately it does not show any code. If I put the 5 categories in the database and link dropdown there will that solve my problem?

Thanks
JD

Have a look at using inputs inside repeaters here.
https://www.wix.com/corvid/forum/corvid-tips-and-updates/example-input-repeaters

Demonstrates using input components in a Repeater. The Inline actions tab shows how to do inline actions using buttons embedded in the repeater items. The Global Actions tab has buttons on the page outside of the Repeater that apply actions to the selected Repeater items.

To view the code simply turn on Corvid in the Wix Editor example and you will be able to see the code for both the Inline Actions page and the Global Actions page.

The page demonstrates this Wix API references which all give code examples too.
https://www.wix.com/code/reference/$w.Repeater.html
https://www.wix.com/code/reference/$w.Checkbox.html
https://www.wix.com/code/reference/$w.TextInput.html
https://www.wix.com/code/reference/$w.Dropdown.html

The values in my dropdown are NOT in the database but hard coded in the dropbox settings. Please allow me to explain:
For each “Roundup” there are many photos in ANOTHER database of the same roundup#. What The repeater does is using a ROUNDUP-INFO database to show each roundup, by year, when held, hosts, and # cars(see the screenshot). Then when the user selects one of the 5 categories, the category and roundup number is set in a session variable and a lightbox photo gallery/slideshow opens to view the photos for that roundup# by getting those two session variables and matching that roundup and category in the ROUNDUP-PHOTOS database. For this code and page the photos database is not needed.

I am just not understanding the example code as it seems to be doing updates to the database…

Nevermind. I used BUTTONS with events instead and it is working as I wish.

Went back to the idea of the dropdown and changed the code for the dropdown event on change, include $w

export function dropdown1_change(event,$w) {
category = $w(“#dropdown1”).value
console.log("category: ", category) //Add your code for this event here:
}

The page is now working as originally intended.