How can I make a lightbox appear (when a form is submitted) only when specific criteria are met on the form?

So, I want to make our “Review Us” lightbox appear when someone submits a 4 or 5 star review on our reviews page. In my research, I’ve been testing it with just the 5 star rating to make sure it work, but no matter what I do, I can’t get the lightbox to pop up.

The form submits fine every time, but the lightbox will not show up.

The code I have tried is below:

attempt 1:

import wixWindow from 'wix-window';

export function submitbtn_click(event) {
 let newValue = $w("#dropdown1").value;
 if (newValue === "5 Stars - Excellent") {
    wixWindow.openLightbox("Review Us");
  }
}

attempt 2:

import wixWindow from 'wix-window';

export function submitbtn_click(event) {
 if ($w("#dropdown1").value === "5 Stars - Excellent") {
    wixWindow.openLightbox("Review Us");
  }
}

Thanks in advance

What do say the console?

import wixWindow from 'wix-window';

export function submitbtn_click(event) {console.log("Submit-Clicked")
  let newValue = $w("#dropdown1").value;
  console.log("newValue: ", newValue)
  
  if (newValue === "5 Stars - Excellent") {console.log("IF-running")
      wixWindow.openLightbox("Review Us");
  }
  else {console.log("ELSE-running")}
}

I think this is what you’re looking for:

workerLogger.js:103 function submitbtn_click is registered as a static event handler but is not exported from the page code. Please remove the static event handler or export the function.

I just tried this as well:

import wixWindow from 'wix-window';

$w("#submitbtn").onClick( (event) => { 
 let newValue = $w("#dropdown1").value;
 
 if (newValue === "5 Stars - Excellent") 
      wixWindow.openLightbox("Review Us");
  }
);

This wouldn’t work either