Reload page with new dataset value after dropdown onchange

Can somebody post sample code for me as I have spent 2 days now trying to figure this out? I have a backend page which creates new data or updates existing data. I have built a dropdown input which lets you select from existing dataset. However, I have not been able to reload the existing item page with the result.

export function boatdropdown_change(event, $w) {
$w(“#dataset1”).onReady(() => {
let test = $w(‘#boatdropdown’).value;
test = test.replace(/\s/g,‘-’);
*wixData.query(‘boats’)
.contains(‘title’, test)
.find()
.then(res => {
[this is the part i can’t figure out, i am not using a table, so i can not display results on a table. It will be one result which should reset the form values on the page]
});
});
}

Hello Koray,
you have to use the res to update the elements you want,
See the code below:

export function dropdown1_change(event, $w) {
	$w("#dataset1").onReady(() => { 
	let test = $w('#dropdown1').value;
	wixData.query('datasetName')
	  .eq('title', test)
	  .find()
	  .then((res)=> {     
                $w("#title").text= res.items[0].text;
                
	   });
	 });	 
}

Hope this help you.

Best,
Mustafa

hi mustafa,

sad you didn´t even receive a little thank you for your effort.

since I´m struggeling with almost the same problem, …
may I kindly ask for a little help!?!?
MY CODE already looks like a mess and gets worse and worse. ;-( :-))))

WHAT I want to do is: select a name from one of my databases, read some linked time-fields and wanna change/update some of the fields (they are all connected to the “right” FIELD.
after selecting a new name I WANT TO “reload” the FIELDS concernig the name i selected to.

it always selects and connects to the first line of the database.
I TRIED to adopt the code above but failed aswell.

i really need help ;-)))

cheers
thomas