Now when importing a form field repeat array comes across as object not array?

Has there been another change the way Wappler deals with $Post arrays? Or am I now doing something wrong???

When I now pull across arrays from a Form it displays as an object - this:

object

But should be like this:

array

Why is this now different? which is the correct format?

Thanks!

code:

<div class="form-row" is="dmx-repeat" id="questions" dmx-bind:repeat="get_polls_history.data.get_questions" key="id">
                            <div class="col-12">
                                <div class="row">
                                    <div class="col d-flex">
                                        <input id="question_id" name="question_id" dmx-bind:name="questions[{{id}}][question_id]" type="text"
                                            class="form-control" dmx-bind:value="get_questions.id">
                                        <input id="topic_id" name="topic_id" dmx-bind:name="questions[{{id}}][topic_id]" type="text" class="form-control" dmx-bind:value="id">
                                        <input id="poll_id" name="poll_id" dmx-bind:name="questions[{{id}}][poll_id]" type="text" class="form-control" dmx-bind:value="get_polls.data.get_poll_id.id">

                                    </div>
                                </div>

I notice your input names are:

dmx-bind:name="questions[{{id}}][question_id]"

what is this {{id}} there? Should be

dmx-bind:name="questions[{{$index}}][question_id]"

in order to be imported as an array. That’s how the multi update forms are being gnerated.

HI @Teodor eodor

The {{id}} is the ID for the question in the array if I don’t pass the questions database ID how does server connect know which question it is? $index just tells the array which order it is in, but the question ID in an array of questions might be IDs

68
78
88

Maybe i am missing something here, but i don’t fully understand what are you doing on this page exactly. At least i can’t understand by looking at the 5 lines of code taken from the whole page.

Hi @Teodor

Is OK I fixed it. It’s complicated because its a survey form and is passing back question and answer IDs in an array.

Just deleted the post objects created by Wappler and added the arrays manually and now works as expected and no errors.

Thanks. Go back to Holiday beers!

1 Like