Multi Update not working

Trying to setup a Multi Record update.
I created the query to get records.
created the update action and generated boostrap 4 form for this.
The Content gets loaded into the form OK.
Dynamic Event onSuccess also fires when I click save
But the records do not get updated.
I Pull the records from the db based on the 3 select inputs shown in the pic. Seems to work fine because the right records get pulled into the form waiting for update. Some how the update does not work. What I’m I doing wrong?

Hi,

Try adding a set value step with output on and value as $_POST to check if you are receiving the values as expected or not.

Hi Sid,
Can you elaborate further?

No sure how. Maybe this screenshot will help:

image

can you copy the codes here (just form )

<form is="dmx-serverconnect-form" id="serverconnectform1" method="post" action="../dmxConnect/api/update_results/update_president_results.php" dmx-generator="bootstrap4" dmx-form-type="horizontal"

                                                dmx-multi="true" dmx-populate="sc_get_presi_result.data.get_presi_results" dmx-on:success="successToast.show({message: 'Success'})">

                                                <div id="record" is="dmx-repeat" dmx-bind:repeat="sc_get_presi_result.data.get_presi_results">

                                                    <div class="form-group row">

                                                        <label for="inp_id" dmx-bind:for="insp_id_{{$index}}" class="col-sm-2 col-form-label">Id</label>

                                                        <div class="col-sm-10">

                                                            <input type="number" class="form-control" id="inp_id" name="id" dmx-bind:id="insp_id_{{$index}}" dmx-bind:aria-describedby="insp_id_{{$index}}_help" dmx-bind:name="record[{{$index}}][id]"

                                                                dmx-bind:value="id" aria-describedby="inp_id_help" placeholder="Enter Id">

                                                        </div>

                                                    </div>

                                                    <div class="form-group row">

                                                        <label for="inp_CANDIDATE_NAME" dmx-bind:for="insp_CANDIDATE_NAME_{{$index}}" class="col-sm-2 col-form-label">Candidate name</label>

                                                        <div class="col-sm-10">

                                                            <input type="text" class="form-control" id="inp_CANDIDATE_NAME" name="CANDIDATE_NAME" dmx-bind:id="insp_CANDIDATE_NAME_{{$index}}"

                                                                dmx-bind:aria-describedby="insp_CANDIDATE_NAME_{{$index}}_help" dmx-bind:name="record[{{$index}}][CANDIDATE_NAME]" dmx-bind:value="CANDIDATE_NAME"

                                                                aria-describedby="inp_CANDIDATE_NAME_help" placeholder="Enter Candidate name">

                                                        </div>

                                                    </div>

                                                    <div class="form-group row">

                                                        <label for="inp_REGION" dmx-bind:for="insp_REGION_{{$index}}" class="col-sm-2 col-form-label">Region</label>

                                                        <div class="col-sm-10">

                                                            <input type="text" class="form-control" id="inp_REGION" name="REGION" dmx-bind:id="insp_REGION_{{$index}}" dmx-bind:aria-describedby="insp_REGION_{{$index}}_help"

                                                                dmx-bind:name="record[{{$index}}][REGION]" dmx-bind:value="REGION" aria-describedby="inp_REGION_help" placeholder="Enter Region">

                                                        </div>

                                                    </div>

                                                    <div class="form-group row">

                                                        <label for="inp_CONSTITUENCY" dmx-bind:for="insp_CONSTITUENCY_{{$index}}" class="col-sm-2 col-form-label">Constituency</label>

                                                        <div class="col-sm-10">

                                                            <input type="text" class="form-control" id="inp_CONSTITUENCY" name="CONSTITUENCY" dmx-bind:id="insp_CONSTITUENCY_{{$index}}" dmx-bind:aria-describedby="insp_CONSTITUENCY_{{$index}}_help"

                                                                dmx-bind:name="record[{{$index}}][CONSTITUENCY]" dmx-bind:value="CONSTITUENCY" aria-describedby="inp_CONSTITUENCY_help" placeholder="Enter Constituency">

                                                        </div>

                                                    </div>

                                                    <div class="form-group row">

                                                        <label for="inp_PARTY" dmx-bind:for="insp_PARTY_{{$index}}" class="col-sm-2 col-form-label">Party</label>

                                                        <div class="col-sm-10">

                                                            <input type="text" class="form-control" id="inp_PARTY" name="PARTY" dmx-bind:id="insp_PARTY_{{$index}}" dmx-bind:aria-describedby="insp_PARTY_{{$index}}_help"

                                                                dmx-bind:name="record[{{$index}}][PARTY]" dmx-bind:value="PARTY" aria-describedby="inp_PARTY_help" placeholder="Enter Party">

                                                        </div>

                                                    </div>

                                                    <div class="form-group row">

                                                        <label for="inp_RESULT" dmx-bind:for="insp_RESULT_{{$index}}" class="col-sm-2 col-form-label">Result</label>

                                                        <div class="col-sm-10">

                                                            <input type="number" class="form-control" id="inp_RESULT" name="RESULT" dmx-bind:id="insp_RESULT_{{$index}}" dmx-bind:aria-describedby="insp_RESULT_{{$index}}_help"

                                                                dmx-bind:name="record[{{$index}}][RESULT]" dmx-bind:value="RESULT" aria-describedby="inp_RESULT_help" placeholder="Enter Result">

                                                        </div>

                                                    </div>

                                                    <div class="form-group row">

                                                        <label for="inp_RESULT_CONFIRMED" dmx-bind:for="insp_RESULT_CONFIRMED_{{$index}}" class="col-sm-2 col-form-label">Result confirmed</label>

                                                        <div class="col-sm-10">

                                                            <input type="number" class="form-control" id="inp_RESULT_CONFIRMED" name="RESULT_CONFIRMED" dmx-bind:id="insp_RESULT_CONFIRMED_{{$index}}"

                                                                dmx-bind:aria-describedby="insp_RESULT_CONFIRMED_{{$index}}_help" dmx-bind:name="record[{{$index}}][RESULT_CONFIRMED]" dmx-bind:value="RESULT_CONFIRMED"

                                                                aria-describedby="inp_RESULT_CONFIRMED_help" placeholder="Enter Result confirmed">

                                                        </div>

                                                    </div>

                                                </div>

                                                <div class="form-group row">

                                                    <div class="col-sm-2">&nbsp;</div>

                                                    <div class="col-sm-10">

                                                        <button type="submit" class="btn btn-primary" dmx-bind:value="Save">Save</button>

                                                    </div>

                                                </div>

                                            </form>

In the multi-update, it repeats through $_POST.record.

In the update server action you need to just put {{id}} (not $_POST.id) so that it looks for the id field of the ‘record’ being processed.

I couldn’t see the Columns and Values tab of the update action in your screenshot but if you were setting the candidate name for example, you would use {{CANDIDATE_NAME}} as the value. Within the repeat, that would look for $_POST.record[i].CANDIDATE_NAME (i is just the index of the repeat)

Too many form fields have errors.

  1. remove duplicate “name” attributes
  2. remove duplicate id
  3. open chrome console
  4. click “headers” section you will see the data when post progress done
  5. crate array on server connect
    5 add field names into array on server connect
    6 then use server connect repeater

The form is ready, but you need to make a few changes in server connect.

<form is="dmx-serverconnect-form" id="serverconnectform1" method="post" action="../dmxConnect/api/update_results/update_president_results.php" dmx-generator="bootstrap4" dmx-form-type="horizontal"
                                                dmx-multi="true" dmx-populate="sc_get_presi_result.data.get_presi_results" dmx-on:success="successToast.show({message: 'Success'})">
                                                <div id="record" is="dmx-repeat" dmx-bind:repeat="sc_get_presi_result.data.get_presi_results">
                                                    <div class="form-group row">
                                                        <label for="inp_id" dmx-bind:for="'insp_id_'+$index" class="col-sm-2 col-form-label">Id</label>
                                                        <div class="col-sm-10">
                                                            <input type="number" class="form-control" dmx-bind:id="'insp_id_'+$index" dmx-bind:aria-describedby="'insp_id_'+$index+'_help'" dmx-bind:name="record[{{$index}}][id]"
                                                                dmx-bind:value="id" placeholder="Enter Id">
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">
                                                        <label dmx-bind:for="'insp_CANDIDATE_NAME_'+$index" dmx-bind:for="'insp_CANDIDATE_NAME_'+$index" class="col-sm-2 col-form-label">Candidate name</label>
                                                        <div class="col-sm-10">
                                                            <input type="text" class="form-control" dmx-bind:id="'insp_CANDIDATE_NAME_'+$index"
                                                                dmx-bind:aria-describedby="'insp_CANDIDATE_NAME_'+$index+'_help'" dmx-bind:name="record[{{$index}}][CANDIDATE_NAME]" dmx-bind:value="CANDIDATE_NAME"
																	placeholder="Enter Candidate name">
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">
                                                        <label dmx-bind:for="'insp_REGION_'+$index" class="col-sm-2 col-form-label">Region</label>
                                                        <div class="col-sm-10">
                                                            <input type="text" class="form-control" dmx-bind:id="'insp_REGION_'+$index" dmx-bind:aria-describedby="'insp_REGION_'+$index+'_help'"
                                                                dmx-bind:name="record[{{$index}}][REGION]" dmx-bind:value="REGION" placeholder="Enter Region">
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">
                                                        <label dmx-bind:for="'insp_CONSTITUENCY_'+$index" class="col-sm-2 col-form-label">Constituency</label>
                                                        <div class="col-sm-10">
                                                            <input type="text" class="form-control" dmx-bind:id="'insp_CONSTITUENCY_'+$index" dmx-bind:aria-describedby="'insp_CONSTITUENCY_'+$index'_help'"
                                                                dmx-bind:name="record[{{$index}}][CONSTITUENCY]" dmx-bind:value="CONSTITUENCY" placeholder="Enter Constituency">
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">
                                                        <label dmx-bind:for="'insp_PARTY_'+$index" class="col-sm-2 col-form-label">Party</label>
                                                        <div class="col-sm-10">
                                                            <input type="text" class="form-control" dmx-bind:id="'insp_PARTY_'+$index" dmx-bind:aria-describedby="'insp_PARTY_'+$index+'_help'"
                                                                dmx-bind:name="record[{{$index}}][PARTY]" dmx-bind:value="PARTY" placeholder="Enter Party">
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">
                                                        <label dmx-bind:for="insp_RESULT_{{$index}}" class="col-sm-2 col-form-label">Result</label>
                                                        <div class="col-sm-10">
                                                            <input type="number" class="form-control" dmx-bind:id="insp_RESULT_{{$index}}" dmx-bind:aria-describedby="insp_RESULT_{{$index}}_help"
                                                                dmx-bind:name="record[{{$index}}][RESULT]" dmx-bind:value="RESULT" placeholder="Enter Result">
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">
                                                        <label dmx-bind:for="'insp_RESULT_CONFIRMED_'+$index" class="col-sm-2 col-form-label">Result confirmed</label>
                                                        <div class="col-sm-10">
                                                            <input type="number" class="form-control" dmx-bind:id="'insp_RESULT_CONFIRMED_'+$index"
                                                                dmx-bind:aria-describedby="insp_RESULT_CONFIRMED_{{$index}}_help" dmx-bind:name="record[{{$index}}][RESULT_CONFIRMED]" dmx-bind:value="RESULT_CONFIRMED"
																placeholder="Enter Result confirmed">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="form-group row">
                                                    <div class="col-sm-2">&nbsp;</div>
                                                    <div class="col-sm-10">
                                                        <button type="submit" class="btn btn-primary" dmx-bind:value="Save">Save</button>
                                                    </div>
                                                </div>
                                            </form>

This is the screenshot for that

It would be worth having different $_POST input names (in the SC action) to your column names if you are using it within a repeat. e.g. CANDIDATE_NAME_UPD
Otherwise the repeat (on the page) will have a field within the repeat called CANDIDATE_NAME as well as an input with name CANDIDATE_NAME

In the update change the values to {{CANDIDATE_NAME_UPD}} {{REGION_UPD}} {{CONSTITUENCY_UPD}} etc…
Then change the dmx-bind:name of the inputs to have the ‘_UPD’ added at the end of their name.