Get data from a field in the same table row

This sample code gets the value of a field in a table row, when a value of another field in the same row changes. In this example, we've simply outputted this into an alert box.

Sample Image

sametablerow.gif

Sample Code

//When a checkbox in a table is selected, 
//the value of a field in the same row is retrieved and shown in an alert dialog

(function() {
    "use strict";
    var TEXT = 'mytext'; // field code of text field in a table
    var CHECKBOX = 'mycheckbox'; // field code of radio button field in the same table
    var events = ['app.record.create.change.' + CHECKBOX, 'app.record.edit.change.' + CHECKBOX];

    kintone.events.on(events, function(event) {
        var changedRow = event.changes.row;
        var text = changedRow.value[TEXT].value;
        alert(text);
    });
})();

Notes

Make sure to match the Field code of your fields, with the Field code written in the code.

 

Refer to the Tutorial page, on how to add scripts to your app.

Was this article helpful?
0 out of 0 found this helpful
Comments
Please sign in to leave a comment.