My code won't set DataBase Field...

The following code isn’t working, PLEASE HELP ME:

export function button61_click(event, $w) {
//...
//curuser_accountca = an integer...
$w("#dataset1").setCurrentItemIndex(Number(curuser_accountca) - 1);
}
export function dataset1_currentIndexChanged() {
	$w("#dataset1").setFieldValue("nome", $w("#input1").value);
	$w("#dataset1").setFieldValue("descricao", $w("#textBox1").value);
}

export function dataset1_itemValuesChanged() {
	wixLocation.to("https://pptgamespt.wixsite.com/crate/myaccount");
}
1 Like

I think you need to do a dataset save before you navigate to another page.

e.g.

export async function dataset1_itemValuesChanged() {
  await $w("#dataset1").save();
  wixLocation.to("https://pptgamespt.wixsite.com/crate/myaccount"); 
}

Didn’t work. I think the problem is before that… I don’t :frowning:

Hi,

In your previous code example there was a missing parenthesis:

export function button61_click(event, $w) {
    //...
    //curuser_accountca = an integer... 
    $w("#dataset1").setCurrentItemIndex(Number(curuser_accountca) - 1);
} ) // <==== missing parenthesis 

//...

Please elaborate on what is not working. Note that it is not enough to call setFieldValue. Calling save() after the field change will save the data into the collection.

You can paste the relevant code here.

I already figured it out. But thanks anyways.