@mikkelhmogensen A better approach would be to not connect the button to the dataset submit and handle it all in code. So what you would do:
-
Remove the connection between the submit button and the dataset submit property.
-
Add the following code to the $w.onReady() section:
$w (“#NameOfTheSubmitButton”). onClick (( event ) => {
$w ( ‘#dataset2’ ).save()
.then ((response) => {
// data saved!
$w ( ‘#dataset2’ ).refresh()
})
.catch ((error) => {
// Error saving data
console.log(error);
})
});
When the submit button is clicked, this code will save the dataset record and then call the refresh after the save has successfully completed. This way you don’t need to mess around with time delays or multiple events.