DMXzone Server Connect Support Product Page
Answered
Insert field values as array
Asked 28 Mar 2016 17:14:06
1
has this question
28 Mar 2016 17:14:06 manuel pinto posted:
I have a form whose name of fields are in brackets like for example name[] ... wish to insert values on my database with no sucess (in this case values will be sent as array) ... any ideia about the reason for that? I'm using dmxzone server connect (add database insert) ... is there a special procedure for inserting values on this case? Replies
Replied 21 Nov 2017 01:39:47
21 Nov 2017 01:39:47 Ben Pleysier replied:
I know that this is an old post, but could you give me the solution please
Replied 21 Nov 2017 07:35:50
21 Nov 2017 07:35:50 Teodor Kuduschiev replied:
Hi Ben,
What exactly your issue is? What is happening and what is supposed to happen?
What exactly your issue is? What is happening and what is supposed to happen?
Replied 22 Nov 2017 00:31:09
22 Nov 2017 00:31:09 Ben Pleysier replied:
This is the code:
<div class="form-check form-check-inline" dmx-repeat="scUitrusting.data.qryUitrusting" id="repeat1">
<label class="form-check-label">
<input name="uitrusting[]" type="checkbox" class="form-check-input" value="" dmx-bind:id="uitrusting{{$index}}" dmx-bind:checked="detOccasion.data.uitrusting.contains(uitrusting)"> {{uitrusting}}
</label>
</div>
What I want to do is that the checked boxes are inserted into the table row as per
Voortent, Stabilisator, Serviceluik, Voortentlamp, Accu, Omvormer, Koelkast, Afzuigkap, Kachel, Ringverwarming, Cassettetoilet, Combi-rollo's
In other words, the non-checked boxes are not added to the field.
Prior to the DMXZone functionality, I have successfully coded this using MySQLi
<div class="form-check form-check-inline" dmx-repeat="scUitrusting.data.qryUitrusting" id="repeat1">
<label class="form-check-label">
<input name="uitrusting[]" type="checkbox" class="form-check-input" value="" dmx-bind:id="uitrusting{{$index}}" dmx-bind:checked="detOccasion.data.uitrusting.contains(uitrusting)"> {{uitrusting}}
</label>
</div>
What I want to do is that the checked boxes are inserted into the table row as per
Voortent, Stabilisator, Serviceluik, Voortentlamp, Accu, Omvormer, Koelkast, Afzuigkap, Kachel, Ringverwarming, Cassettetoilet, Combi-rollo's
In other words, the non-checked boxes are not added to the field.
Prior to the DMXZone functionality, I have successfully coded this using MySQLi
Replied 22 Nov 2017 08:20:19
22 Nov 2017 08:20:19 Teodor Kuduschiev replied:
So you want to insert every checkbox into a new row, and not storing their values into one field comma separated, is that right?
Replied 22 Nov 2017 12:33:23
22 Nov 2017 12:33:23 Ben Pleysier replied:
Hi Teodor,
Looking at the Uitrusting Form above, I would like the checked/ticked items to be inserted in my table row as follows
Accu, Afzuigkap, Indirecte verlichting, Kachel, Koelkast, Mover, Oven, Reservewiel, Reservewielhouder, Ringverwarming, Voortent
In other words, rather than inserting a single value, I need to insert an array
Looking at the Uitrusting Form above, I would like the checked/ticked items to be inserted in my table row as follows
Accu, Afzuigkap, Indirecte verlichting, Kachel, Koelkast, Mover, Oven, Reservewiel, Reservewielhouder, Ringverwarming, Voortent
In other words, rather than inserting a single value, I need to insert an array
Replied 22 Nov 2017 13:16:21
22 Nov 2017 13:16:21 Teodor Kuduschiev replied:
Hi Ben,
First thing i do not see a value in your inputs, add some using dynamic attributes in app connect please.
Then, when inserting the record, just use the join filter for the uitrusting[] field value:
First thing i do not see a value in your inputs, add some using dynamic attributes in app connect please.
Then, when inserting the record, just use the join filter for the uitrusting[] field value:
{{$_POST.uitrusting.join(",", "")}}
Replied 23 Nov 2017 00:06:36
23 Nov 2017 00:06:36 Ben Pleysier replied:
Senior moment! Thank you, thank you. And the join was the cream that I desperately needed.
With apologies,
Ben