Copy link to clipboard
Copied
What I still would like to do is when I make a selection from drop down A to trigger drop down B and trigger drop down C. Let me explain a bit. Each drop down has the same names of people but with different info. Such as drop down A would have the addresses. Drop down B would have their social security numbers and C would have their phone numbers.
So then when a name is selected in drop down A the address info would show in text field A. Drop down B would be triggered and to show the social in another text field and C would do the same but with their phone numbers.
Can someone help me with this? I don't know javascript enough to figure it out so I have to ask for someone's help to get it done. If you know the javascript could you share it with me so I can learn a bit more? Thanks guys.
I'm using Acrobat Pro X on a Macbook Pro.
Copy link to clipboard
Copied
Why not just use one drop down and then use a script to retrieve the needed information from an array or object?
Changing another field with combo box (drop down) selection by Thom Parker
Even thought this might be considered "old" it still works. Download the example and see for your self.
Copy link to clipboard
Copied
I like Thom Parker's design. I've a question that Susan asked, but I would appreciate any assistance with a text field.
I just thought of another question to go along with my previous one. Since this is for an order form and I’ll have several item numbers, would it be better to just have the client be able to type in the item number instead of using the dropbox? And if so, how can I achieve that?
Thanks again!
gkaiseril wrote
Why not just use one drop down and then use a script to retrieve the needed information from an array or object?
Changing another field with combo box (drop down) selection by Thom Parker
Even thought this might be considered "old" it still works. Download the example and see for your self.
Copy link to clipboard
Copied
Hello,
Thanks for your reply, but I'm not adept in what you are suggesting. In Tom's example, he is using Alpha characters, if you use numeric, it will not populate the fields. For example, if a zip code 10048: var DeptData = { 10048:{ Location: "Ground Zero NY"}
There will be no results populated in the Location field as the zip is numeric.
Sean
Copy link to clipboard
Copied
Even if it's numeric you should treat it as text and put it in between double-quotes.
Copy link to clipboard
Copied
I tried the quotes "1234", this is the solution. Thanks,
Copy link to clipboard
Copied
You should be aware that Acrobat JavaScript handles numbers a floating point values and suppresses leading zeros and also will not treat the value as a string unless forced to do so. For data like Zip Codes, Social Security Numbers, or IDs that may have leading zeros it is necessary to access the field's value using the "valueAsString" property to retain the entered leading zero. Also to determine the number of digits or length of a numeric value one needs to force the value to a string by using the "String" constrictor or some other trick to force the the value to a string. Length has no meaning to the compressed or packed number format.
Copy link to clipboard
Copied
Thank you for your reply, but forgive my ignorance to you knowledge of Java. I truly don't understand what you meant.
Copy link to clipboard
Copied
The code you are writing is JavaScript and not Java. Java is a computer language and requires several steps to convert from the text to the machine executable code. JavaScript on the other hand can be run within a PDF form by using the JavaScript console. It can also be easily fixed by just editing the JavaScript text for an action that halts at an error by just correcting the code and restarting the action.
All data on a computer is stored in coded values. For form fields the values are either text or numbers. Text can be symbols, alphabetical characters or numbers. Numbers can only be 0-9, "+", "-" or one decimal point. Numbers are stored using a special code and which cannot be treated like a text but numbers can be converted to text by using the "String" constrictor of JavaScript or the "valueAsText" property of the field object. If you field is data like a phone number, SSN, or 5 digit Zip code, Acrobat forms does not include the formatting characters just the numeric digits. If you want the leading zeros or the value as entered by the use you must use the "valueAsString" method for the field. Any number between quotation marks is considered to be text.
Copy link to clipboard
Copied
I don't see anywhere in that code where this comes into play... There's no use of the value property of any fields there, only when assigning a value and then you have to use it, as valueAsString is a read-only property.
Copy link to clipboard
Copied
Hello, Thank you for your explanation. When I referenced Java, I meant JavaScript. Sorry for any misunderstanding.
I tried the quotes "1234", this is the solution. I'm not familiar with JavaScript, as a result, I do not know what is "valueAsText" property of the field object or "valueAsString". How would this be used? Can you provide an example? I would appreciate as I'm trying to understand and learn.
Copy link to clipboard
Copied
Take a look at the documentation for the valueAsString property:
Acrobat DC SDK Documentation - Field.valueAsString
You would use it just like the value property of the Field object.
Copy link to clipboard
Copied
Thank you Karl for your time and knowledge in assisting me with this example. I now have a reference document!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now