Help in finding right script
I got a script from chatGPT for adobe acrobat dc pro
"When I select a value from dropdown list and want on a textbox automatically like
When I select N/A then textbox should be empty
when I select 0 then textbox should have a value of 0%
when I select 1 then textbox should have a value of 25%
when I select 2 then textbox should have a value of 50%
when I select 3 then textbox should have a value of 75%
when I select 4 then textbox should have a value of 100%"
but I dont get any result when I run the followng javascript,
// Replace "DropdownFieldName" and "TextboxFieldName" with the actual field names in your document
var dropdownField = "DropdownFieldName";
var textboxField = "TextboxFieldName";
// Define the mapping of dropdown values to textbox values
var valueMapping = {
"N/A": "",
"0": "0%",
"1": "25%",
"2": "50%",
"3": "75%",
"4": "100%"
};
// Get the dropdown and textbox fields
var dropdown = this.getField(dropdownField);
var textbox = this.getField(textboxField);
// Set up a change event handler for the dropdown field
dropdown.setAction("OnBlur", function() {
var selectedValue = dropdown.value;
// Set the textbox value based on the selected value from the dropdown
if (valueMapping.hasOwnProperty(selectedValue)) {
textbox.value = valueMapping[selectedValue];
}
});
