Copy link to clipboard
Copied
I have dropdown list that contains different kinds of Nature of Business. One of the values is "OTHER". What I currently have is when I choose "OTHER" from dropdown it will become an editable text. But the problem is the export value, if I edit the "OTHER" to "OTHER PREVIOUS JOB" the export value will become "OTHERS PREVIOUS JOB" too, what i want is to retain the export value of "OTHER" which is "OTHER". I dont want to make changes on export value rather make changes only in the description. Im a complete noob on JavaScript heres my code on custom format script:
field = getField(event.target.name);
if (field.value == "OTHER") {
field.editable = true;
field.setFocus();
} else {
field.editable = false;
}
var nValue = this.getField('InsuredData.natureOfBusiness').value;
var othersX = nValue.match("OTHER");
if (othersX == "OTHER"){
event.value = event.target.getItemAt(event.target.currentValueIndices, true);
}
Copy link to clipboard
Copied
I would use a separate text field for the user input in case they select "Other" in the drop-down, not the drop-down field itself.
Copy link to clipboard
Copied
The export of the "Other" selection doesn't change. As soon as the user types over the selected value, the dropdown value is no longer the selected value, it's the entered value, so no export. Try67 has the correct answer, use a text field for "Other" data entry. Hide this field and then use the "Other" selection to un-hide it.
https://www.pdfscripting.com/public/Hiding-and-Showing-Form-Fields.cfm?sd=40
There is also another technique, you can gray out a field to make it look disabled.
https://acrobatusers.com/tutorials/js_disabling_fields/
Copy link to clipboard
Copied
Thank you so much guys!