😅Sử dụng Object.assign và để copy dữ liệu, edit, input, form (ok)

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    document.body.appendChild(Object.assign(document.createElement('p'), {
      textContent: 'Pluto is no longer considered a planet. (Check you console for more information).'
    }))
  </script>
</body>
</html>
(function() {
  "use strict";
  kintone.events.on([
    'app.record.create.show',
    'app.record.edit.show'
  ], function(event) {
    var mySpaceFieldButton = document.createElement('button');
    mySpaceFieldButton.id = 'button-copy';
    mySpaceFieldButton.classList.add("gaia-ui-actionmenu-save");
    mySpaceFieldButton.innerHTML = '申込者と共同申込者入れ替え';
    var buttoncopy = document.getElementById("user-js-button-copy");
    buttoncopy.append(mySpaceFieldButton);
    mySpaceFieldButton.onclick = function() {
      var record_data = kintone.app.record.get();
      var {record: {text1, text2, text3, textcopy1, textcopy2, textcopy3}} = record_data;
      var sub_stack = {
        "textcopy1": Object.assign({}, text1),
        "textcopy2": Object.assign({}, text2),
        "textcopy3": Object.assign({}, text3),
      };
      textcopy1.value = sub_stack.textcopy1.value;
      textcopy2.value = sub_stack.textcopy2.value;
      textcopy3.value = sub_stack.textcopy3.value;
      kintone.app.record.set(record_data);
    }
  });
  kintone.events.on([
    'app.record.detail.show'
  ], function(event) {});
})();

Last updated