DMXzone App Connect Support Product Page

Answered

Checkbox Insert/Update

Asked 05 Sep 2018 04:34:17
1
has this question
05 Sep 2018 04:34:17 Duncan Brooking posted:
Hi,
I'm having trouble trying to add/update to a database from some checkboxes. I have 6 checkboxes that are bound to 6 columns in my database. Any combination of the 6 can be checked. I've set the column types to TINYINT(1). I've got a Data Detail bound to a form to show the checkboxes as checked if the value is 1 and unchecked for any other value. I can't however update (or insert) a value. Text boxes and text areas in the form work fine.

This is the HTML code for one of the update checkboxes:

<label for="k1">1</label><input name="k1" type="checkbox" id="k1" dmx-bind:value="d_detail.data.k1" dmx-bind:checked="d_detail.data.k1==1">


Any ideas?

Replies

Replied 05 Sep 2018 06:55:09
05 Sep 2018 06:55:09 Teodor Kuduschiev replied:
Hey Duncan,
You just need to use the Checkbox group component (available in app connect).

Insert it in the detail region, and bind your dynamic value, returned from the database to it: prntscr.com/kqrark
Then inside the checkbox group component insert a checkbox and your static value to it - i believe it should be value="1" if you are using boolean field: prntscr.com/kqrauq

The checkbox group component will automatically check the checkbox if it receives a value of "1" from your database.
Replied 05 Sep 2018 09:23:55
05 Sep 2018 09:23:55 Duncan Brooking replied:
Thanks Teodor,
It's partially working. The checkbox shows as checked if the value from the database is 1. I can uncheck it and submit the update and that changes the value in the database to 0, but then no other updates work. I check the box, submit and the value stays as 0. I can't get the value back to 1.


<div class="checkbox-group" id="k1" is="dmx-checkbox-group" dmx-bind:value="d_detail.data.k1"><label for="checkbox1">1</label><input name="checkbox1" type="checkbox" id="checkbox1" value="1"></div>


Thanks in advance.
Replied 05 Sep 2018 12:59:32
05 Sep 2018 12:59:32 Teodor Kuduschiev replied:
Please provide a link to your page where i can check this.
Replied 06 Sep 2018 08:34:48
06 Sep 2018 08:34:48 Duncan Brooking replied:
Thanks Teodor. I think I got it figured out. I was using a dynamic attribute for the value of the checkbox before submitting instead of setting it as static. Works perfectly now.
Replied 05 Nov 2019 22:20:38
05 Nov 2019 22:20:38 Jay Pena replied:
Hey Teodor I have made the move to wappler, but have to use dreamweaver for this site. I tried the suggestion above to use the static value to put a 1 in the database if checkbox is checked, but it will not write a one to the database. Please tell me what is going wrong here. www.ahiabenefits.com/careers/AEcareer.php
Select anything from the list on the right to edit and the checkbox is at the bottom of the page.
Replied 05 Nov 2019 22:31:50
05 Nov 2019 22:31:50 Jay Pena replied:
Teodor I'm sorry I'm saying this wrong - I just want to have the checkbox insert a "1" into the DB if the end user checks it. It is not the same problem Duncan had above. If you check the box which is set to a static value of "1" it will not write a "1" to the DB. Form works fine except for that. Please let me know - thanks.

Reply to this topic