Question:
a) Do you use → WixForms?
b) Or do you have generated an own CUSTOM-FORM ?
Also i can see that you are using a DATASET …
$w('#bagnallLatest').onReady(()=>{letstatus=$w('#bagnallLatest').getCurrentItem();
But using wix-data —> to insert / save items…
wixData.insert('Bagnall',formData).then(()=>{
You are mixing DATASET with Wix-Data → and this is why you get problems.
If you already are using a DATASET which connects your form with DATABASE, why not using…
- https://www.wix.com/velo/reference/wix-dataset/dataset/add
- setFieldValues - Velo API Reference - Wix.com
- https://www.wix.com/velo/reference/wix-dataset/dataset/save
…instead to switch to wix-data-api, what is not really needed to be done in your case.
So your solution would look like…
If → (a) —> $w WixForms - Velo API Reference - Wix.com
If → (b + dataset) —> https://www.wix.com/velo/reference/wix-dataset/dataset/onaftersave
If → (b + wixData-API) —> NOT RECOMMENDE IN YOUR CASE !!!
If you already started to work with DATASET, do everything with DATASET-CODING, do not mix it with Wix-DATA-API-CODES.
BUT IF YOU WANT TO USE IT ANYWAY —> an inserting process needs time!
If this does not work properly…
wixData.insert('Bagnall',formData).then(()=>{$w('#successMessage').show();$w('#formDoneNext').show();$w("#bagnallLatest").refresh();}).catch(()=>{$w('#errorMessage').show();})
Add a TIME-DELAY for REFRESHING-PROCESS (about 1-second ) 1000 milisecs.
wixData.insert('Bagnall',formData).then(()=>{$w('#successMessage').show();$w('#formDoneNext').show();setTimeout(()=>{$w("#bagnallLatest").refresh();},1000);}).catch(()=>{$w('#errorMessage').show();})
Did it work?
Which kind of version did you use at the end?
2-more things !!!
VERY GOOD !!! →
$w('#btnSubmit').onClick(()=>{
—> best code-part in your whole code.
Here you did everything perfect, giving your SUBMISSION-BUTTON a perfect definition!
How could i know emmidiatelly, that it is a SUBMISSION-BUTTON ? ![]()
Not perfect variable-declaration !!! (you surely will understand why) !
doorNumber:$w(‘#doorNo’).value,
surveyDate:$w(‘#surveyDate’).value,
fireGlassPanel:$w(‘#fireGlass’).value,
intumescentStrip:$w(‘#iStrip’).value
And last note:
YOU DO NOT NEED MORE THAN ------> 1-$w.onReady() <----in your whole code. Your page can get ready —> JUST ONE TIME !