I am trying to display data inside a Kintone App's Detail Edit page.
I created an "OK" button with a "click" event handler.
I can see the value of record['hidden_text']['value'] correctly stored in the record, but I don't know why it is not displayed on the Detail Edit page.
kintone.events.on("app.record.edit.show", function (event) {
let record = event.record;
let btnOK = document.getElementById("btn_ok");
btnOK.addEventListener("click", () => {
signatureImage.src = signaturePad.toDataURL();
record['hidden_text']['value'] = signatureImage.src;
});
}
This is the console.log() showing the value is stored in record['hidden_text']['value']
hidden_text:
type: "MULTI_LINE_TEXT"
value: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA4QAAAB4CAYAAACq9jzEAAAAAXNSR0IArs4c6QAADbxJREFUeF7t3T9oFE0YB+AJWlipSEBs/AOxC0Z7Qa0sLFRstDKCfbSwE9TGSlC7FIKmsT
The process of setting values to fields appears to be missing here.
Processing in the click event handler is handled as processing outside the event handler. The following functions are required to get and set record values.
■ kintone.app.record.get function
Gets the currently open record data in JSON format.
■ kintone.app.record.set function
Sets the value to the currently open record.
Moreover, if the following process is used, at the timing of the button being clicked, "hidden_text" field will be filled with any value (hogehoge for example) that can be set.
kintone.events.on("app.record.edit.show", function (event) {
let btnOK = document.getElementById("btn_ok");
btnOK.addEventListener("click", () => {
let wRecord= kintone.app.record.get();
let record = wRecord.record;
record['hidden_text']['value'] = "hogehoge";
kintone.app.record.set(wRecord);
});
});
Hopefully, this helps.