Update value in custom component

hello there!
i have a custom which is acting as a number input component (the reason im not using a number input component is because i need it to step up and down in 0.25) and i want to update its value with a press of a button.
heres my component code:
model:
{
"number": {{ (TableExamsHistory.selectedRow === null || NewFormContoller.value === "New") ? 0 : TableExamsHistory.selectedRow['dv-r-add-subjective'] }}
}
iframe:

html, body { margin: 0; padding: 0; height: 100%; width: 100%; } #stepper { display: flex; align-items: center; height: 100%; width: 100%; justify-content: center; } input[type="number"] { background-color: #d7f2d3; width: 100%; height: 100%; border: 1px solid #000000; padding: 0; margin: 0; font-size: 14px; -moz-appearance: textfield; /* Hide spinner in Firefox */ -webkit-appearance: none; /* Hide spinner in Chrome, Safari, Edge, and Opera */ border-radius: 5px; /* Rounded corners */ } /* Hide spinner in Chrome, Safari, Edge, and Opera */ input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
<div id="stepper">
  <input id="dv_r_add_subj" type="number" step="0.25" oninput="handleInputChange(event)" style="text-align: center;" />
</div>

now i want to update the number displayed from a button pressed. i tried many thing like adding preloaded js that looks like this
image

and then calling this funciton with a value from the button script. this didnt work.
it should be quite simple all i want to do for example is change the value to 3 on the press of a button

i found the Solution! i just had my syntex a bit wrong but its quite easy, all i needed is:
dv_r_add_subj.updateModel({ number: dv_r_add_present.model.number });
where dv_r_add_subj is component name

1 Like