Solved

Acrobat Forms - Populate field based on Combo Box selection

Posted on 2016-10-13
7
28 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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

This article is in response to a question here (http://www.experts-exchange.com/Other/URLs/Q_28283850.html) at Experts Exchange. The Original Poster has a scanned signature and wants to make the background transparent so that the signature may be pl…
Update 21-May-2015: I temporarily removed the source code to make major changes to the program. Regards, Joe In a previous Experts Exchange article, How To Rename-Move a Batch of PDF Files Based on Contents of the Files (http://www.experts-exchan…
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…

759 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

17 Experts available now in Live!

Get 1:1 Help Now