Hi,
I have a dropdown in my custom html element which calls a function in the JS sandbox.
This works fine, but I am not sure how to access the event details so I can get hold of the value that was selected.
What I want to do:
Select an option from an html <Select> element
- An onchange event is run in JS
- Get the value of the selected option in the dropdown box
- Put this value into a field on the form
This is in my custom HTML
<SELECT onchange="doSomething(event);">
<option value ="Apple">
<option value ="Orange">
<option value ="Banana">
</SELECT>
This is my JS:
window.doSomething = async function (event) {
var selectedValue = event.target.value;
LFForm.setFieldValues( {fieldId: 40}, selectedValue);
}
The event is called when an item is selected but I don't know how to get the selected value. Any help greatly appreciated.
Thank you :)