Hopefully I can explain this clearly…
I have a page set up where people can schedule a time with one of our consultants. I use a repeater to list the available times from a dataset and they can select a time to reserve it. The trouble comes in if more than one person has the page open at the same time - they are both able to select the same time and whoever selects it second overwrites the first person. Because it’s part of a repeater, I can’t refresh/filter the dataset when they choose a time. How can I confirm that a time is still available when someone chooses it?
The page is https://www.dprepsafety.com/schedule
The code is:
$w ( “#daveButton” ). onClick (( event , $w ) => {
$w ( "#emailD" ). updateValidityIndication ();
if ( $w ( "#emailD" ). valid ) {
let itemObj = $w ( "#daveSchedule" ). getCurrentItem ();
let iDate = itemObj . time ;
console . log ( itemObj );
console . log ( iDate );
const options = {
day : "numeric" ,
month : "long" ,
year : "numeric" ,
hour : "2-digit" ,
minute : "2-digit" ,
timeZoneName : "short"
};
$w ( "#daveSchedule" ). setFieldValues ({
"email" : $w ( '#emailD' ). value ,
"name" : $w ( '#nameD' ). value ,
"department" : $w ( '#departmentD' ). value
});
$w ( '#daveSchedule' ). save ()
. then (( response ) => {
console . log ( "Done saving the dataset" );
$w ( '#daveRepeater' ). collapse ();
console . log ( iDate );
$w ( '#dateOutD' ). text = iDate . toLocaleDateString ( "en-US" , options );
$w ( '#daveDateGroup' ). expand ();
})
. catch (( error ) => {
console . log ( error );
})
}
})
Thank you!