Hi guys, I have two forms, each connected with a dataset:
Application form (dataset1 write only) where we have to pick a costumer with a dropdown (reference to customer collection)
In case the customer is not in the database yet, I have a second form New Customer (dataset2 write only).
Question: When I save the New Customer I also refresh the other dataset but, the dropdown is not refreshed and I can't pick the new customer. Only if I am reloading the site, it is added. Is there a way to refresh the object? I am using the following code on the customer save button:
$w.onReady(function () { //Neuer Kunde Speichern $w("#button6").onClick(() => { $w("#dataset2").save() .then(() => { if ($w("#columnStrip1").collapsed) { $w("#columnStrip1").expand(); } else { $w("#columnStrip1").collapse(); } }); //wixLocation.to("https://www.home4motion.com/neues-erstgespraech") }) $w("#dataset2").onAfterSave( () => { $w("#dataset1").refresh() $w("#dataset3").refresh() console.log("datset 1 refrehed"); } );
![](https://static.wixstatic.com/media/a27d24_ab29047117e24f368b0be19ec6ccfd3f~mv2.png/v1/fill/w_980,h_646,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/a27d24_ab29047117e24f368b0be19ec6ccfd3f~mv2.png)
Many thanks for your input!
If both datasets are set to write only, then how can either dataset read any new user input?
Hence why your dropdown only shows the new user input after the page is also refreshed and both the page and the datasets have reloaded with the new content in them.
A dataset can be in one of three modes, which are set in Dataset Settings panel in the Editor. The dataset's mode cannot be changed programmatically.
Read & Write: Display and modify data.
Read-only: Display data.
Write-only: Add new data.
https://www.wix.com/corvid/reference/wix-dataset.html
https://support.wix.com/en/article/adding-and-setting-up-a-dataset
https://support.wix.com/en/article/about-collection-permissions
if you want to refresh the page as a whole and stay on the same page, then simply set your wixLocation.to - wixLocation.to(wixLocation.url); //This reloads the same page