I discovered that Handlebars aren't something from Gamesparks, but a separate library. I managed to figure it out just by looking up Handlebars stuff, and it's a pretty simple fix.
Just had to change the one line in the HTML to be:
<option value="{{_id.$oid}}" {{#compare this._id.$oid "===" ../this}}selected{{/compare}}>{{name}}</option>
This needs to be added to documentation somewhere, I looked forever for this. Thankyou.
Clayton Vanvolkenburg
I'm a hobbyist developer, and I'm pretty inexperienced with server/html coding. I'm currently having trouble creating a dropdown menu for an array in dynamic forms.
I have a meta collection "Cities" and each city object contains an array of any size, along with some other properties. The elements of this array are the $oids of objects from another meta collection, "Regions"
Essentially, I'm trying to query the "Regions" meta collection for all objects in it, and use those as options. I've currently got all the options showing up correctly, but I can't get it to display the selected object correctly.
Here is the relevant Javascript:
Here is the relevant HTML:
And here is the json data that I'm trying to get this to work with.
"Cities" meta collection object:
"Regions" meta collection objects:
Currently, with this data and code, I get an error:Parse error on line 26: ... "===" ../form.city.regions[@index]}}sel -----------------------^ Expecting 'ID', got 'INVALID'
Which is being caused by this section here:
{{#compare _id.$oid "===" ../form.city.regions[@index]}}
What do I set for the compare function here to compare the value of the array vs. the id of the region object?
Thanks for any help. As I mentioned, I'm just a hobbyist, so please let me know if I haven't explained something well.