Hi all! New to coding here. A kindergartener if you will - so please explain solutions well, for my sake. Lol
I have a dynamic page which has a repeater that displays job listings for nurses. When a nurse clicks on the job listing they like, it will open another dynamic page that displays a detailed view of that job. I’ve placed a button on the detailed view page (#quickapply), so instead of filling out our in-depth application, they can quickly apply with a few shorter inputs on a form within a Lightbox.
Each job has a unique Job Number (which is also displayed on the detailed view page (#jobnumber) and is connected to the dataset (#dynamicDataset). I want that Job Number to replace an input value within the Lightbox form (#input8) and I just haven’t been able to get it right. I can easily place the form on the page and connect #input8 to the dataset so it auto-fills the job number according to which job the nurses are looking at, but I want it to be a Lightbox instead.
Any and all help is appreciated. Tagging @okeyiwobi as his last code worked great for me! The code below is what I came up with based on some other posts I’ve read, but I think I’m missing something significant.
*I should add - there are other similar posts that I’ve read here about this, but each one is slightly different from what I am wanting, so I could never find a code that worked for me.
Page:
import wixWindow from 'wix-window'
import wixData from 'wix-data'
$w.onReady(function () {
})
export function quickapply_click(event) {
let dataObj = {
"JobID": $w("#jobnumber").text,}
wixWindow.openLightbox('Quick Apply', dataObj);
}
Lightbox:
import wixWindow from 'wix-window';
import wixData from 'wix-data'
$w.onReady( function () {
let dataObj = wixWindow.lightbox.getContext();
$w('#input8').value = dataObj.JobID
})
For reference:
Button - #quickapply
Job Number text (on page) - #jobnumber
Lightbox name - ‘Quick Apply’ or #lightbox1
Dataset on page - #dynamicDataset
Lightbox input - #input8
The actual collection is called ‘Jobs’ and the field key for the Job Number is: ‘jobId’
Here’s a pic of the form when I have it on the page and ideally how I want input8 to look within the Lightbox. It also disables the users from changing that input.
Thanks in advance!!