Is there a better way to do this without the mapping? I don't see a getElementByID function as I know js queries are run in a sandbox. I am moving one of my dialogs from a submit form to a dynamically updated form on blur. I want to setDisabled the element while the query runs. I'd like to not have to maintain this objectMapping list
const objectMapping = {
"cadURLInput": cadURLInput,
"indexTextInput": indexTextInput,
"bomLevelTextInput" : bomLevelTextInput,
"isRoot" : isRoot,
"checkboxAssembly" : checkboxAssembly,
"deliverQuantityTextInput" : deliverQuantityTextInput,
"innateQuantityTextInput" : innateQuantityTextInput,
"xTextInput" : xTextInput,
"yTextInput" : yTextInput,
"zTextInput" : zTextInput,
"partNumberText" : partNumberText
};
const SELF = objectMapping[triggeredById];
const KEY = objectMapping[triggeredById].formDataKey
const VALUE = objectMapping[triggeredById].value
SELF.setDisabled(true);
const options = {
additionalScope: { KEY, VALUE },
onSuccess: function(data) {
// Code to execute when the query is successful
SELF.setDisabled(false);
dataStore.setIn([KEY], VALUE);
console.log("Query succeeded");
// For example, trigger another query
},
onFailure: function(error) {
console.log('Update failed:', error)
SELF.setDisabled(false);
},
};
UpdateField.trigger(options);