I created a Lightbox, added a user input field for phone and a button to submit that phone to my collection. However I need that same button to close the Lightbox right after.
I had used this code this work perfectly fine but user also abe to close the light box without adding phone number how to make it compulsory so that user can close the lightbox when added his phone number
The required option is turned on but then too it closes
my website is www.orooms.in
import wixData from ‘wix-data’;
import wixWindow from ‘wix-window’;
export function button8_click(event) {
const toInsert = {
mobileNumber: $w(‘#input1’).value
}
wixData.insert(‘VisitorsMobileNumber’, toInsert)
.then(() => {
wixWindow.lightbox.close();
});
}