Hi,
I need to capture the current user Id to insert it in a new item of a collection.
My code:
import wixData from ‘wix-data’;
import wixUsers from ‘wix-users’;
export function button13_onclick() {
let DATO = $w(“#input21”).value;
let usuario = $w (wixUsers.currentUser.id);
let insert = {
“id_evento”: DATO,
“usuario”: usuario,
};
$w.onReady( () => {
$w(“#dataset6”).onReady( () => {
wixData.insert(“PROTOCOLOS”, insert);
$w(“#dataset6”).save();
} );
} );
$w(“#dataset6”).refresh();
}
Using this code, I have a validation error. The data I insert in the id field is JS type instead of text type.
Someone may help me?