Copy link to clipboard
Copied
I'm new here and fairly new to creating PDF forms. Here is what I am trying to accomplish on my PDF form. I created a Drop Down Menu and in the Properties-Options Item section I entered employee names and in the Export Value their phone number. My hopes are when selecting their name from the drop down menu it will insert their phone number in a text field, that's the function I am trying to figure out.
Thanks
George
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Do you want the phone text field to be editable by the user, or should it
always have a value based on the selection in the drop-down?
Copy link to clipboard
Copied
Always based on the drop down slection
Copy link to clipboard
Copied
As the custom calculation script of the Phone field enter this code (adjust the field name as required):
event.value = this.getField("employee").value;
Copy link to clipboard
Copied
Ok - So I create a text field name it employee and insert this code ?
Copy link to clipboard
Copied
Lost need more direction !
Copy link to clipboard
Copied
No. "employee" was what I assumed the drop-down field was called... Replace it with the actual field name, as I'm mentioned.
Copy link to clipboard
Copied
Got that - I changed the drop down name to employee, what's next, insert this code in the text field - Custom Calculation ?
Copy link to clipboard
Copied
It's working !!!
Thank You Greatly Appreciated !
Copy link to clipboard
Copied
Yes.
Copy link to clipboard
Copied
Hi, I have something similar I would like to do. I have a dropdown box which I want to use to poplulate a textbox with the export value of each choice. The difference is that I want to use the dropdown box as a multi-select box. Each time you select a value, it adds it to the textbox. If you select the same value again, it deletes it from the textbox. My dropdown has Items with a descriptive value and Export Values with a code, so that the form user can pick what they want without having to know the code; while the form receiver can quickly use the codes to complete the task.
I found a document level script online here and it works great, but does not place the Export Value, only the Item value. Would you know what needs to be replaced in the code to access the Export Value instead of the Item value? I had understood (maybe incorrectly) that if the Export Value was filled in, that that automatically became the value that would be chosen, but it doesn't seem to execute that way.
I have asked the question here rather than there, as it says that that forum is now read only. Thanks very much for any assistance you can provide.
Copy link to clipboard
Copied
To add items to the same value use the "+=" operator
this.getField("textfield").value += event.value;
Read this article for more detail on how use a Keystroke script to get the export value:
https://acrobatusers.com/tutorials/change_another_field
You'll find much more info on list fields here:
https://www.pdfscripting.com/public/List-Field-Usage-and-Handling.cfm
Copy link to clipboard
Copied
Thank you for your reply. Unfortunately, I have read the links that you provided already. I got lost on the part about pre-population data in the document script as all I want is a list with Item values that returns the Export values. I apologize that I am not a javascript programmer. My limits are finding a script online and filling in my fields in place of the fields in the script and hoping it works. The script I found works fine, adding items and removing items to the textbox from the combo box with a click. That is not the issue. The issue is that it places the Item Value, whereas I would like it to place the Export value. This is a document level script, so adding a keystroke script would be starting all over again from scratch with script in the Keystroke box on the Format tab, would it not?
Copy link to clipboard
Copied
Please post your question to a new thread. Include a description of what you want to achieve, the current code you are using, and clearly specify the feild event where this code is being run.
Copy link to clipboard
Copied
My apologies, I did not think it was appropriate to start a new thread for the same basic question. I will do so now.
Copy link to clipboard
Copied
New post is here as requested.
Copy link to clipboard
Copied
i want to edit this text field ... how plz ??
Copy link to clipboard
Copied
Please be more specific about the situation and what you want to achieve.
Copy link to clipboard
Copied
Hi, I have this exact requirement with two small changes i.e.
Copy link to clipboard
Copied
Make the text field that shows the phone number editable.
Or do you mean that you want the export values of the dropdown items (phone numbers) to change when the phone number field is edited?
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more