I am trying to get my database to update with the date and time of a submission onClick of a ‘Submit’ button.
Currently tried (From www.wix.com/code/reference/wix-data.html#update):
let toUpdate = {
“expiration”: $w.getTime()
};
export function button26_click(event, $w) {
wixData.update(‘#dataset1’, toUpdate)
.then( (results) => {
let item = results; //see item below
} )
.catch( (err) => {
let errorMsg = err;
} );
}
I have also tried:
let toUpdate = $w.getTime();
export function button26_click(event, $w) {
$w(‘#dataset1’).setFieldValue(‘expiration’, toUpdate);
}
This does not throw any errors in the console but it does not update the collection ‘Expiration’ column either.
Basically what I have is a set of redemption codes that can be redeemed by retailers and on the redemption code dynamic item page it shows the expiration date of the codes. I want to be able to update the expiration to the date/time the code was redeemed (submit button clicked) to make it easier to stand out if the redemption codes dynamic item page is pulled up again and has already been redeemed.