Restricting Fields

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.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
  ];'', function (event) {
    var record = event.record;
    record.text_0.disabled = true;
    return event;
  });, 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;

Hi Caneel1,

I tested out based on the code you provided and was able to set the “text_0” field to be non-editable.
It seems like the “text_0” field is the only field that has the disabled property set to true.

So, I am quite unsure what the issue here is.
Perhaps the field code is just incorrectly specified.

Could you kindly make sure that the field code is “text_0” for the field you want to disable editing?

Also, if you do not see a problem in specifying the field codes, please give me the details of what is happening and what you would like to address.

Thank you.

1 Like

Thank you for your help.