vendredi 22 décembre 2017

How to edit data array to checkbox with javascript

Table Form HTML

 <table id="example3" class="display" cellspacing="0" width="100%">
      <thead>
         <tr>
           <th></th>
           <th>Nama</th>
           <th>Unit</th>
        </tr>
      </thead>
    </table>

Javascript to headle select row

$('#frm-example').on('submit', function(e){ //on submit
            var form = this;

           var rows_selected = table3.column(0).checkboxes.selected();

            // Iterate over all selected checkboxes
            $.each(rows_selected, function(index, rowId){
            // Create a hidden element 
                $(form).append(
                    $('<input>')
                    .attr('type', 'hidden')
                    .attr('name', 'id[]')
                    .val(rowId)
                );
            });

My database

+-----------+--------------+---------------+-----------+-------------+-----------+------------------------------+---------------------+
| id_survey | judul_survey | status_survey | id_target | id_kategori | responden | detail_target                | tgl_survey          |
+-----------+--------------+---------------+-----------+-------------+-----------+------------------------------+---------------------+
|       130 | tes          | terbit        |         3 |           2 |         2 | 198411162009101002,H76215021 | 2017-12-19 15:08:35 |
+-----------+--------------+---------------+-----------+-------------+-----------+------------------------------+---------------------+
1 row in set (0.07 sec)

Data checkbox in field detail_kategori, how i can put this into form checkbox for update?

Ok, i get code checkbox from here http://ift.tt/2dDLkF4 I want modify the code to edit




Aucun commentaire:

Enregistrer un commentaire