Setting boolean value to true after a certain time period! is this possible?
Any help is greatly appreciated
Setting boolean value to true after a certain time period! is this possible?
Any help is greatly appreciated
Iโm sorry I didnโt understand the question.
You can use setTimeout function
setTimeout( function (){
$w( โ#checkbox1โ ).checked = true
}, 3000 );
@workiapps Hi ! Thanks for replying! appreciate it. Im afraid it get a little complex!
I have a database that ia have a field of boolean (false) but instead of a checkbox i have a button on click to set that field to true.
what I need is to have max time period that field automatic to true coz sometimes they forget to click the button.
setTimeout(function(){
$w('#dataset1').setFieldValue(โfieldkeyโ, true)
$w('#dataset1').save()
}, 3000);
Learn more on wix-dataset - Velo API Reference - Wix.com
@workiapps thanks again for replying.
maybe ur thoughts on this coz its a little complicated than a simple database but there has got to be a way. thanks
let toUpdate = {
'_id': itemID,
'inLine': false,
'serving': false,
'served': true,
'queueNo': 0,
'towernameAndUnit': data.tower,
'boolean': false
}
setTimeout(function(){
toUpdate.boolean = true
}, 3000)
wixData.update("PMONOWSERVING", toUpdate)
//////////////////////// Another method
let toUpdate = {
'_id': itemID,
'inLine': false,
'serving': false,
'served': true,
'queueNo': 0,
'towernameAndUnit': data.tower
}
wixData.update("PMONOWSERVING", toUpdate)
.then((item))=>{
setTimeout(function(){
item.boolean = true
wixData.update("PMONOWSERVING", item)
}, 3000)
}
/////Hook Method
export function PMONOWSERVING_beforeUpdate(item, context) {
item.boolean = true
return item;
}