Thanks Roi. So just for a bit of background, on my page I have a repeater that is hooked up to my database. The repeater has a picture, title, author, description, and a ‘request button’. I also have a search implemented of the database so that as a user types, the search automatically narrows down the items in the repeater. I got the code from the Wix Code video examples and it works flawlessly. Since I am trying to build a Lending Library I need to now add a function that when the button in the repeater is clicked, the page remembers which repeater is selected (specifically the title of the book) and then opens a Lightbox with a fillable form and auto-fills one of the inputs with that book title.
This is the code on the page. At the end the onClick function is what I implemented based on azevedo.bang suggestion. And everything before that is for the search from Wix Code examples. Input1 here is the text box that contains the title in the repeater.
$w.onReady( function () {
//TODO: write your page related code here…
});
import wixData from ‘wix-data’;
let debounceTimer;
export function iTitle_keyPress(event, $w) {
if (debounceTimer) {
clearTimeout(debounceTimer);
debounceTimer = undefined;
}
debounceTimer = setTimeout(() => {
filter($w(‘#iTitle’).value);
}, 200);
}
let lastFilterTitle
function filter(title) {
if (lastFilterTitle !== title) {
$w(‘#dataset1’).setFilter(wixData.filter().contains(‘title’, title));
lastFilterTitle = title;
}
}
export function buttonR_click(event, $w) {
session.setItem(‘PassingData’, $w(‘#input1’).value);
}
And this is what I have in the lightbox. Again input1 is an input box that is supposed to be automatically filled.
import {session} from ‘wix-storage’;
$w.onReady( function () {
const Data = session.getItem(‘PassingData’);
$w(‘#input1’).text = “Data”;
});
Sorry for the long explanation, I am still fairly new to Wix Coding (and coding in general).
Any help would be greatly appreciated!