MULTI INSERT RECORDs

I am trying to create a multi insert form for about an hour now without success.
I have followed the DMX tutorial here to the letter but still not getting it to work.

After generating the form via boostrap 4 form generator and adding the expression, the form doesnt even show up.
Hoping someone can point me in the right direction

What’s the code generated for the form and is it not showing in the browser also?

This is the code for the form. No it doesnt show in the browser also

                                        <form is="dmx-serverconnect-form" id="serverconnectform1" method="post" action="../dmxConnect/api/g_inserts/mp_multi_insert.php" dmx-generator="bootstrap4" dmx-form-type="vertical">

                                            <div id="record" is="dmx-repeat" dmx-bind:repeat="filters.number_of_records.value">

                                                <div class="form-group">

                                                    <label for="inp_CANDIDATE_NAME" dmx-bind:for="insp_CANDIDATE_NAME_{{$index}}">Candidate name</label>

                                                    <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]" aria-describedby="inp_CANDIDATE_NAME_help" placeholder="Enter Candidate name">

                                                </div>

                                                <div class="form-group">

                                                    <label for="inp_REGION_ID" dmx-bind:for="insp_REGION_ID_{{$index}}">Region</label>

                                                    <input type="number" class="form-control" id="inp_REGION_ID" name="REGION_ID" dmx-bind:id="insp_REGION_ID_{{$index}}" dmx-bind:aria-describedby="insp_REGION_ID_{{$index}}_help"

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

                                                </div>

                                                <div class="form-group">

                                                    <label for="inp_REGION" dmx-bind:for="insp_REGION_{{$index}}">Region</label>

                                                    <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]" aria-describedby="inp_REGION_help" placeholder="Enter Region">

                                                </div>

                                                <div class="form-group">

                                                    <label for="inp_CONSTITUENCY" dmx-bind:for="insp_CONSTITUENCY_{{$index}}">Constituency</label>

                                                    <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]" aria-describedby="inp_CONSTITUENCY_help" placeholder="Enter Constituency">

                                                </div>

                                                <div class="form-group">

                                                    <label for="inp_GENDER" dmx-bind:for="insp_GENDER_{{$index}}">Gender</label>

                                                    <input type="text" class="form-control" id="inp_GENDER" name="GENDER" dmx-bind:id="insp_GENDER_{{$index}}" dmx-bind:aria-describedby="insp_GENDER_{{$index}}_help"

                                                        dmx-bind:name="record[{{$index}}][GENDER]" aria-describedby="inp_GENDER_help" placeholder="Enter Gender">

                                                </div>

                                                <div class="form-group">

                                                    <label for="inp_PARTY" dmx-bind:for="insp_PARTY_{{$index}}">Party</label>

                                                    <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]" aria-describedby="inp_PARTY_help" placeholder="Enter Party">

                                                </div>

                                                <div class="form-group">

                                                    <label for="inp_MAP_ID" dmx-bind:for="insp_MAP_ID_{{$index}}">Map</label>

                                                    <input type="text" class="form-control" id="inp_MAP_ID" name="MAP_ID" dmx-bind:id="insp_MAP_ID_{{$index}}" dmx-bind:aria-describedby="insp_MAP_ID_{{$index}}_help"

                                                        dmx-bind:name="record[{{$index}}][MAP_ID]" aria-describedby="inp_MAP_ID_help" placeholder="Enter Map">

                                                </div>

                                                <div class="form-group">

                                                    <label for="inp_BATTLEGROUND" dmx-bind:for="insp_BATTLEGROUND_{{$index}}">Battleground</label>

                                                    <input type="number" class="form-control" id="inp_BATTLEGROUND" name="BATTLEGROUND" dmx-bind:id="insp_BATTLEGROUND_{{$index}}" dmx-bind:aria-describedby="insp_BATTLEGROUND_{{$index}}_help"

                                                        dmx-bind:name="record[{{$index}}][BATTLEGROUND]" aria-describedby="inp_BATTLEGROUND_help" placeholder="Enter Battleground">

                                                </div>

                                                <div class="form-group">

                                                    <label for="inp_INCUMBENT" dmx-bind:for="insp_INCUMBENT_{{$index}}">Incumbent</label>

                                                    <input type="number" class="form-control" id="inp_INCUMBENT" name="INCUMBENT" dmx-bind:id="insp_INCUMBENT_{{$index}}" dmx-bind:aria-describedby="insp_INCUMBENT_{{$index}}_help"

                                                        dmx-bind:name="record[{{$index}}][INCUMBENT]" aria-describedby="inp_INCUMBENT_help" placeholder="Enter Incumbent">

                                                </div>

                                                <div class="form-group">

                                                    <label for="inp_STATUS" dmx-bind:for="insp_STATUS_{{$index}}">Status</label>

                                                    <input type="number" class="form-control" id="inp_STATUS" name="STATUS" dmx-bind:id="insp_STATUS_{{$index}}" dmx-bind:aria-describedby="insp_STATUS_{{$index}}_help"

                                                        dmx-bind:name="record[{{$index}}][STATUS]" aria-describedby="inp_STATUS_help" placeholder="Enter Status">

                                                </div>

                                                <div class="form-group">

                                                    <label for="inp_PHOTO" dmx-bind:for="insp_PHOTO_{{$index}}">Photo</label>

                                                    <input type="text" class="form-control" id="inp_PHOTO" name="PHOTO" dmx-bind:id="insp_PHOTO_{{$index}}" dmx-bind:aria-describedby="insp_PHOTO_{{$index}}_help"

                                                        dmx-bind:name="record[{{$index}}][PHOTO]" aria-describedby="inp_PHOTO_help" placeholder="Enter Photo">

                                                </div>

                                                <div class="form-group">

                                                    <label for="inp_ELEC_YEAR" dmx-bind:for="insp_ELEC_YEAR_{{$index}}">Elec year</label>

                                                    <input type="text" class="form-control" id="inp_ELEC_YEAR" name="ELEC_YEAR" dmx-bind:id="insp_ELEC_YEAR_{{$index}}" dmx-bind:aria-describedby="insp_ELEC_YEAR_{{$index}}_help"

                                                        dmx-bind:name="record[{{$index}}][ELEC_YEAR]" aria-describedby="inp_ELEC_YEAR_help" placeholder="Enter Elec year">

                                                </div>

                                            </div>

                                            <div class="form-group">

                                                <button type="submit" class="btn btn-primary">Save</button>

                                            </div>

                                        </form>

                                    </div>

Where is this value coming from then?

dmx-bind:repeat="filters.number_of_records.value">

And what value is it expected to return?

this value is from a select input is expeted to return a number. 1,2,3...5


Hello @Teodor any update on this?

Sorry i somehow missed your reply yesterday.

The issue is probably because of the value not a number. You need to convert the select value to number, as the inputs always return strings and you cannot use a string in a repeater expression - as it expects a number :slight_smile:

Just use the convert to number formatter for this value:

dmx-bind:repeat="filters.number_of_records.value">
1 Like

thanks @Teodor it was indeed the because the value was not a number.
Now I will like to convert this select input into a button so when the button is clicked, the form will be repeated to add another record.

I know it has to be an onClick dynamic event but how to I get it to increase the initial value of one.