@madsteer Change this …
$w('#input1').onChange(()=>{console.log("My value setted!") myValue=setTimeout(()=>{$w('#input1').value},100);});
to… (try again)
$w('#input1').onChange(()=>{console.log("My value setted!")
myValue = $w('#input1').value; console.log("My-Value: ", myValue)
});
I did a quick TEST-RUN with this code here and everything worked for me…
import wixData from 'wix-data';
//import wixLocation from'wix-location';
let myValue
$w.onReady(()=>{
$w('#input1').onChange(()=>{console.log("My value setted!")
myValue = $w('#input1').value
console.log("My-Value: ", myValue)
});
$w('#button1').onClick(()=>{console.log("Button-1 clicked!")
searchIndex(myValue)
});
});
function searchIndex(VALUE){// VALUE = value from your inputfield.
let DATAFIELD = "index" //<put in here the ID of your DATAFIELD (INDEX)
wixData.query("Team") //<---- put in here the ID of your new DB !
.eq("vorname", VALUE) //<---- This one is new and will do the filtering !
.find()
.then((results) => {console.log(results)
let items = results.items
if(items.length > 0) {
let myURL = results.items[0].url; console.log(myURL)
//wixLocation.to(`${myURL}`);
} else {
// handle case where no matching items found
}
})
}
Check your settings and change my last suggested fix.
Pay also attention to → STRING or NUMBER?
In your case you are searching for —> NUMBER.
myValue = Number($w('#input1')).value