$w().getCurrentItem() not reporting indirectly changed value

I have a dynamic read/write page. One of the field is editable by hand as well as fillable by a selection in other widget (e.g. combobox). (My way of simulating a field that can be one of the predefined value as well as user can input whatever they want).

Problem:
When the input field has been directly edited by user interaction, the $w(“#datasetName”).getCurrentItem() collects that field’s data as unsaved information. However when the same field has been updated by changeHandler of other field such as combobox as in my case,

export function myDropdown_change(event, $w) {
	$w("#textInputField").value = event.target.value;
}

the getCurrentItem() is not picking it up. How can I mark a field as dirty/unsaved for it to be picked up?

The following additional code in the combobox’s change handler, as a workaround made it work.

$w("#myDataset").setFieldValue("columnNameInDatabase", event.target.value);

However I still prefer that even programatic change should have marked the field as unsaved for getCurrentItem() to pick it up.

Hi, since the element is connected to data, you need to set the value through the dataset API, for example $w(“#datasetName”).setFieldValue(“fieldKey”, event.target.value)

Hi Tomer, Thank you for confirmation.

On a side note: for direct interaction with the textInput field, use of this API is not needed, as desired, for getCurrentItem() to work as desired. I suggest for programatic or user-interaction related change to the field’s value to cause it to mark it dirty, thus eliminating need for setFiledValue() to make getCurrentItem() to pick it up with less application level programming.