Save operation failed: DatasetError: Some of the elements

Please suggest fix to this issue

Failed? Some of the elements failed validation I suppose. Before you save add one line per field input you have like $w(“#id-of-field”).valid() and console log them and make sure they are true. That function will compare your entered values with the type of field you have in your data collection.

http://www.wix.com/code/reference/$w.TextInput.html#valid

1 Like

Thanks for help . i made mistake and now fixed, its working

1 Like

Glad it worked for you, I wasted 4 hours a couple of weeks ago on this… so now I use valid all the time.

1 Like

I got this code, what kind of validation do I have to do before save?
User clicks on button4 and $1 is sum to his count that stays on ‘moedas’ column from dynamicDataset but It keeps returning this error and I didn’t understand how to do the validation

import wixData from ‘wix-data’;

export function button4_click(event) {

{$w(‘#button5’).show(); }

$w(“#dynamicDataset”).onReady(() => {
const currentItem = $w(“#dynamicDataset”).getCurrentItem()
const count = currentItem.moedas;
$w(‘#dynamicDataset’).setFieldValues({
‘moedas’: (count+ 1)
})

 $w('#dynamicDataset').save() 
 . **catch** ((err) => { 
 console.log('could not save new rating') 
 }) 

})
}

can you make an example of the coding line