Solved

Acrobat Forms - Populate field based on Combo Box selection

Posted on 2016-10-13
7
52 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
convert pdf to e-book 1 1,021
printing double sided for a pdf document 19 306
How to add vertical lines to 53 pages in Acrobat Pro 1 85
open links in firefox browser 2 39
One of the questions I get asked again and again is how to validate a field value in an AcroForm with a custom validation script. Adobe provided a lot of infrastructure to do that with just a simple script. Let’s take a look at how to do that wit…
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…
Sometimes we receive PDF files that are in the wrong orientation. They may be sideways or even upside down. This most commonly happens with scanned or faxed documents. It is possible to rotate the view of these PDFs with the free Adobe Reader produc…
In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

726 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