But I don’t think I’ve got it right. I have a table containing loads of questions and the page has a query to get a relevant batch of those questions so they can be answered. So I will end up sending the question ID and the answer fields to my API script which will then repeat through them and insert/update the database.
Am I on the right track? Could someone just confirm I’m doing this right or correct me if I’m wrong?
Thanks @mikkime23. I’ve not built the SC yet. I want to make sure the front end is set up correctly to avoid spending ages getting SC to work when the fault will likely lie with the page!
This is on line 12 of my original code snippet. I’ve added the $index to it and have tried with {} and {{}} but none of them are working. What’s the correct way to access the array variable?
Would you say that’s a hard rule. Off the top of my head, there are generators that produce curly brackets as well where you could go without. If it works, are there downsides to using the curly brackets?
If there are objects or arrays involved it gets trickier indeed. And if you are using a mix of array/objects, strings, plain js and are also trying to parse app connect expressions at the same time it becomes hell
I have everything working with the previous suggestions and I've changed the fields...
from dmx-bind:name=response[{{$index}}]
to dmx-bind:name="'response['+$index+']'"
I've kept the static ID in there but am wondering if that's poor practice because every ID should really be unique. It works so I'm not overly fussed but would appreciate any thoughts on that.
When referring to this for another item’s show/hide use the static ID. Wappler will use this and then change the id to satisfy the browser’s unique ID requirement (or other jQuery/JS you might use to identify an element)