Let me know if this works for you. Drop down code included just for better clarity with the function.
<label for="dropdown">Select a value:</label>
<select id="dropdown" onchange="setValue()">
<option value="option1">Option 1</option>
<option value="option2">Option 2</option>
<option value="option3">Option 3</option>
</select>
<input type="text" id="result" readonly>
<script>
function setValue() {
// Get the selected value from the dropdown
var selectedValue = document.getElementById("dropdown").value;
// Set the value to the input field
document.getElementById("result").value = selectedValue;
}
</script>
Original Message:
Sent: Jan 18, 2024 04:44 AM
From: Kristof DeGroote
Subject: Javascript set value of dropdown
Hi Community,
I'm trying to set or select the value of a dropdown list based on the value of another field.
I tried this code on the validation but with no result. Y being the dropdown field.
function validate(FieldContext, attributeValue, changedValue, errorMessage) {
if (attributeValue == "X") {
FieldContext.setFieldValue("Y", "value");
Thanks already for your help,