I am trying to restrict the concatenated fields in the following JS. I do not want anyone to be able to type in the field upon creation or edit. I have tried both and neither works. DO I have it in the wrong place in the JS?
(function () {
var fieldCode1a = 'FGFN_FN'; // Field Codes of Fields to be Combined
var fieldCode1b = 'FGFN_LN';
var fieldCode1c = 'FGFN_DOB';
var fieldCodeOut = 'FNDOB'
var events = [
"app.record.create.show",
"app.record.edit.show",
"app.record.create.submit",
"app.record.edit.submit",
"app.record.index.edit",
"app.record.create.change." + fieldCode1a, "app.record.edit.change." + fieldCode1a,
"app.record.create.change." + fieldCode1b, "app.record.edit.change." + fieldCode1b,
"app.record.create.change." + fieldCode1c, "app.record.edit.change." + fieldCode1c
];
kintone.events.on('app.record.create.show', function (event) {
var record = event.record;
record.text_0.disabled = true;
return event;
});
kintone.events.on(events, function (event) {
var record = event.record;
if (record[fieldCode1a].value != null) {
var Val1a = record[fieldCode1a].value;
};
if (record[fieldCode1b].value != null) {
var Val1b = record[fieldCode1b].value;
};
var Val1c = ''
if (record[fieldCode1c].value != null) {
Val1c = record[fieldCode1c].value;
};
var [YYYY, MM, DD] = Val1c.split("-");
var revdate = `${MM}-${DD}-${YYYY}`;
record[fieldCodeOut].value = Val1a + " " + Val1b + " " + revdate
return event;
});
}());