Hello and good morning
.
Ok i improved the code for this function, now it should be much better than the first version of code.
Check it out ![]()
![]()
import wixData from 'wix-data';
//------------------------------------ USER-DATA-INTERFACE -----------------------------------------
var DATABASE = "Switch-Save-Function"
var DATASET = "dataset1"
//------------------------------------ USER-DATA-INTERFACE -----------------------------------------
var currentItemIndex
$w.onReady(function () {
$w("#"+DATASET).onReady( () => {
$w('#TXTmember').text="Member-"+currentItemIndex
$w('#BTNsave').onClick(()=>{
if ($w('#BTNswitch1').checked===true){$w("#"+DATASET).setFieldValue("btnStatus", true);}
else {$w("#"+DATASET).setFieldValue("btnStatus", false);}
$w("#"+DATASET).save();
})
$w('#BTNnext').onClick(()=>{console.log("NEXT")
currentItemIndex = $w("#"+DATASET).getCurrentItemIndex()+1
console.log(currentItemIndex)
$w('#TXTmember').text="Member-"+currentItemIndex
})
$w('#BTNprevious').onClick(()=>{console.log("PREVIOUS")
currentItemIndex = $w("#"+DATASET).getCurrentItemIndex()+1
console.log(currentItemIndex)
$w('#TXTmember').text="Member-"+currentItemIndex
})
})
});
I will write the new [How2] later ![]()



