Edit Export Value of Custom text in a Dropdown list

Community Beginner ,
Jan 27, 2021 Jan 27, 2021

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);

}

TOPICS
How to, JavaScript, PDF forms

Views

43

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jan 28, 2021 Jan 28, 2021

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jan 28, 2021 Jan 28, 2021

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/

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 28, 2021 Jan 28, 2021

Copy link to clipboard

Copied

LATEST

Thank you so much guys!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines