Dropdown value is undefined

Hi,
Days now, and I can’t figure it out.
I created a dropbox, linked it to a dataset and have the selection list linked to another dataset (both Text).
Imported wixData.
However, when I try to recall $w(“#dropdown1).value it keeps on returning an undefined item, which does not update into the database.
Even when I set $w(”#dropdown1").value = “hello” , it displays blank in the console.

A bit desperate.
Chris

I have it on a dynamic page and just want to update the connected database value with the users dropdown input onChange.

Hi vandevelde,
can you provide some images on how you connected them?
and your code in a code snippit.

Kristof.

All read&write

Console now logs ‘true’ on $w("#dropdown1).valid

And I have a filter on the ‘Ledeninfo dataset’ to select only members that have the Boolean to true in the ‘pilot’ column.

first of all
you can’t assign anything to $w(“#dropdown1”).value
you can assign new things to it using $w(“#dropdown1”).options.
how you do that you can see here
https://www.wix.com/corvid/reference/$w.Dropdown.html#options

so to begin with you should remove that from your onReady().

then to see what is going wrong.

in your onChange function
do console.log(“this is the value : " + $w(”#dropdown1").value + “this is the type of the value : " +typeof $w(”#dropdown1").value)

it could be by removeing evrything in the onready() that evrything works as it should.

Thanks for your reply.

export function dropdown1_change(event) {
let pilot= ($w( “#dropdown1” ).value)
console.log($w( “#dropdown1” ).value) //Shows blank on console!!!
console.log($w( “#dropdown1” ).valid)
console.log( “This the value :” + $w( “#dropdown1” ).value + “This is the type of value:” + typeof $w( “#dropdown1” ).value);
wixData.save( “pil” , pilot)
.then( (results) => {
let item = results; //see item below
} )
. catch ( (err) => {
let errorMsg = err;
}) //Add your code for this event here:
}
Gives me this in the console:
This the value :This is the type of value:string

Chris

Hey chris.
i can’t see what is wrong atm.
if you allow me and trust me you can make a duplicate of your website and add me as contributor.
kristof.print3d@gmail.com

There you go, made some adjustments becous you used the dropdown in a repeater.
working with a repeater is alot different then just a dropdown on your page.
https://www.wix.com/corvid/reference/$w.Repeater.html

added some explenation to the page aswel.

Kristof.

For info.
1/ I want manifest to prefil multiple loads. A pilot and 6 jumpers. Pilots are members that are ‘qualified’ as pilots (boolean in ledeninfo), then jumpers must be ‘active’ to be able to be in a planned load. The planning should be in a (temporarily) database until the drop is completed.
2/(not there yet) In the second dropdown there has to be the type of jump (for each jumper, except the pilot). Options should depend on their (varying) qualifications (qualifications as boolean in ledeninfo) and are listed in ‘Sprongen’.
3/ Third step is assigning a ‘dropverantwoordelijke’ (one of the six jumpers), that, again, have to be qualified to do so. Assigning can be with a boolean, however only one can be assigned per load.
4/ Finally, when the drop is complete, the info must be stored (a database yet to construct) and their account points must be adjusted according points as in ‘Sprongen’ database and the info of the planning has to disappear. (Preferably a message if the load was already checked out on the same day (to avoid double load numbers planning)
Still a way to go…
Just for your understanding where I want to end.

If you already could get me through the first part of point 1 (saving the selected person in the ‘loads’ database upon selection (data should still be there when they are changing pages in the mean time). Info should ideally be based on the unique id of each person, to avoid mix ups when page is reloaded several times. Or let me say, it should be ‘fool-proof’ :slight_smile:

Regards,
Chris

I only changed it so you can console.log your dropdowns.
this way you can see how you access them and how to work with it.
if you have anymore questions feel free to ask.

kristof.

Ok. Thanks a lot!
Might be a bit ambitious for a beginner like me, but maybe, one day, I will get there. I made all this in excel, but would like to change to an online platform.
All for the ‘good cause’ :wink:

Grtz
Chris

well you better start of the good way otherwhise you have to edit it later again and its double work :wink:
if you ever have another question and it involves a repeater,
be sure to mention it
people will be able to help you faster :slight_smile:

and let me know when its finished, maybe i’ll make an appointment trough your website to come skydive :sweat_smile:

Kristof.

Hey, could you please add me as contributor to your site so that I can see why dropdown value logs as undefined as well?

Hi Emir,

Do you also use a dropdown in your repeater?
Add me as a contributor and i’ll take a look [fast.](fast.
Kristof.print3d@gmail.com

I’m)
[Kristof.print3d@gmail.com](fast.
Kristof.print3d@gmail.com

I’m)

Also, what page is the problem so i know where i should look

I’m in no way connected to wix, I’m just here to help.
so adding me is at your own risk.
You can always make a copy of your website and make me a contributor if that website.

Kind regards,
Kristof.