Loading dropdown from dataset

I am writing a custom form for booking and want to create a list of services. Here is my code:-


But the options are not loading. Here is the results:-


This is run in the onReady function.

Mary, always good to have another set of eyes look at something. The label and value properties, when listed in an object statement, need quotes around them.

let oneItem = {
   "label": objValues[1],
   "value": objValues[0]
}

Thanks Anthony. I have done that but the same results. I print the value of oneItem afterward and it looks ok to me. My push to the dropdown doesn’t seem to work.

I didn’t notice the push statement before. I don’t think that you can add items to a dropdown like that. I always declare an empty array at the top and “push” each item into it in the forEach loop. Then, after the forEach loop, assign the array to the dropdown. Make sense?

I would code it, but you did a screen shot, making copying and pasting code impossible. Best to copy and paste code into one of these posts.

Thanks again. I have done this and it is now working. Hurrah.

You’re welcome.