I’m creating a custom component and all is good except I’m having some problem saving a value back out to a field name.
document.getElementById(“fieldname”).value=inputValue;
and this sucessfully places a calculated field onto the form
on screen but when I click save the field value displayed on the form’s field is not saved so I think I’ve got to trigger a field change event on that field.?
I’ve tried
const autosuggest = document.getElementById(“w3w-map”);
autosuggest.addEventListener(
“coordinates_changed”,
(ev,dt) => {
console.log(ev);
// alert(JSON.stringify(dt));
setTimeout(function(){
const searchInput = document.getElementById(“search-input”);
const inputValue = searchInput.value;
document.getElementById(“fielda6jMnn0r75”).value=inputValue;
},100);
// Get a reference to the input field
var fielda6jMnn0r75 = document.getElementById(“fielda6jMnn0r75”);
// Add an event listener for the change event
fielda6jMnn0r75.addEventListener(“change”, function() {
console.log(“Change event fired on fielda6jMnn0r75”);
});
// Set the new value for the input field
//var newValue = inputValue;
//fielda6jMnn0r75.value = newValue;
// Create a new change event
var changeEvent = new Event(“change”, { bubbles: true });
// Dispatch the change event on the input field
fielda6jMnn0r75.dispatchEvent(changeEvent);
}
);
and I can see the change event firing but still the value is not written to the record.

