Solved

Acrobat Forms - Populate field based on Combo Box selection

Posted on 2016-10-13
7
40 Views
Last Modified: 2016-10-17
I have a pdf form. I have a combo box named "CB1" which has below items as a drop down

Two Wheeler
Four Wheeler (Non AC)
Four Wheeler (AC)
Public Transport / Auto

I want that when some one selects these above items from the combo box a field "Rate" should be automatically populated by value
5
7
9
On Actual

So for e.g if someone selects Two Wheeler as a option, the Rate field should be automatically 5 and so on. I tried the below custom calculation script in the "Rate"  field but it is not working. Can anyone help. I have made sure that Commit Immediately option is selected in the Combo Box field.

My script is as below....

var selectedTYPE = this.getField("CB1").value;
if (selectedTYPE=="Two Wheeler") event.value = "5";
else if (selectedTYPE=="Four Wheeler(Non AC)") event.value = "7";
else if (selectedTYPE=="Four Wheeler(AC)") event.value = "9";
else if (selectedTYPE=="Public Transport / Auto") event.value = "On Actual";
else event.value = "";
0
Comment
Question by:Advait Kawthalkar
  • 4
  • 2
7 Comments
 
LVL 30

Accepted Solution

by:
captain earned 500 total points
ID: 41841907
You could use export values. This will make it easiest.

Populate your list in the dropdown values and select the appropriate export value e.g Two Wheeler has "5" in the Export value.

Keep the 'Commit...immediately' ticked

Then use the Custom Calculation Script on your target field 'Rate'
event.value = getField("CB1").value;

That way you can later add new values to your dropdown without having to code new scripts in the target field.

hope that helps
capt.
0
 

Author Comment

by:Advait Kawthalkar
ID: 41846103
Thanks Captain. Will test this and revert back soon.
0
 

Author Comment

by:Advait Kawthalkar
ID: 41846105
IT worked. Thank you Captain.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:Advait Kawthalkar
ID: 41846107
I am sorry but missed on points. If possible would like to give points to Captain.
0
 

Author Comment

by:Advait Kawthalkar
ID: 41846121
I have one more challenge. The drop down value Public Transport does not have a export value. But I need to calculate Amount. For rest of the drop downs since it has export value I can calculate Rate x Kms = Amount in the "Amount " field. But how to manage when someone selects Public Transport as option?
We need a script like if public transport is selected, one can manually edit the Amount field.
0
 
LVL 30

Expert Comment

by:captain
ID: 41846236
If the solution worked you should accept my answer as the solution, not your own. For the additional question you should open a separate thread so you can attract additional experts.

Capt.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PDF files have been in the limelight due to its unmatched features.  Personal documents, emails, business reports and eBooks are all converted into PDF files owing to peerless features provided by it. Adding watermark to a PDF file is a method to se…
The Adobe PDF proprietary file format is recognized as secure and formulated. But these PDF files are also prone to corruption and any external threat like virus attacks, improper storage can hit PDF file integrity.This type of damages can make cruc…
In this first video of the three-part Xpdf series, we introduce and describe Xpdf, a library containing nine command line utilities that perform various functions on PDF files. We show where the library is located and how to download it, discuss its…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now