Expand my Community achievements bar.

SOLVED

Field Calculations within Drop Down Menu

Avatar

Former Community Member

Hello - I am fairly new to Java and I am wondering if this is possible... Trying to make an Order Form for Customers to fill out

I have a form set up with drop down boxes to choose your product.  There are different prices associated with the different items in the drop down box.  Is it possible to make the script calculate in the following way...

     if Value1 is chosen the Price is $1.25 if Value2 is chosen the Price is $2.25 and so on?  I may have a total of 5 items in the drop down box.

Then also I need to know if it would be easier to calculate it by using the text fields instead... for example

     Product 1 is chosen - then the customer fills in the first name and last name text fields but not the 2nd line field the price would be $1.25 or

     Product 2 is choosen - then the customer fills out their first name and second line (no Last Name) and it would make the Price $2.25 and so on...

Basically I have a form with 5 Products, 4 options per product and 1 price associated with each of those products depending on what information is filled in and which information is left blank.  They made this work in Excel and I wanted to know if it will work in here also.  I am using LiveCycle ES2 and Acrobat Pro 10

Please help me if you can - Thanks - BadgeTeam

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

Here is an example: https://acrobat.com/#d=RLlRdnqGtMw6RTFxWCW3rQ

It is based on the same additional costs for first name, last name and title, irrespective of the product selected.

If that is not the case, then the script would need to be extended to look at the value of the dropdown as well.

Hope that helps,

Niall

View solution in original post

5 Replies

Avatar

Level 10

Hi,

It is possible because the dropdown has two properties:

  1. The display value, which is what the user sees; and
  2. The bound value, which is optional.

There are a couple of examples that show the process:

http://assure.ly/fYCuQ2

http://assure.ly/iitzNJ

http://assure.ly/jtTkdO

When setting up the dropdowns, you would go to the Object > Binding tab. For each product you would specify a value (without the currency symbol). Product 1 would have a specified/bound value of "1.25", etc.

Then using script you can access the value of the dropdown:

textfield1.rawValue = productDD.rawValue; 

This would return 1.25 if Product 1 was selected.

The rest of the logic can be achieved with if/else statements.

Hope that helps,

Niall

Avatar

Former Community Member

How do you use the if else statements in this senario?

I have gotten this form to total amounts but I need the selections or field entry(s) to generate the price.

When D13 is selected from the Drop Down Menu - the prices are:

If First Name has text entered only it is 1.25

if First Name and Last Name has text entered the cost is 1.95

if First Name , Last Name , & Title has text entered the cost is 2.95

I understand that I have to add them to a value so for instance:

Drop Down Menu - Value 1 = D13  Value 2 = D153 and Value 3 = D23

The issue I am having is that each value has a different cost associated to it depending on the lines of text going on the product.

I have the Values assigned but I do not know how and cannot find how to make the text fields generate the price for the product.

Is this possible or am I just dreaming?  I am thinking that I just have to have 1 line per product per pricing but that is really not what I want to do.  We have an Excel form that works this way and I would like to mimick it in LiveCycle so our customers can use the PDF.

Thank you again.

Avatar

Correct answer by
Level 10

Hi,

Here is an example: https://acrobat.com/#d=RLlRdnqGtMw6RTFxWCW3rQ

It is based on the same additional costs for first name, last name and title, irrespective of the product selected.

If that is not the case, then the script would need to be extended to look at the value of the dropdown as well.

Hope that helps,

Niall

Avatar

Former Community Member

Thank you for the help - That does work how i need it to however the base rate does come off the drop down menu and the product first and for most  that is what determines what the customer pays but i think i may be able to get it working.  Will let you know thanks.

How do you associate a price to the different items in a drop down menu?  It is somewhat a table definatly with rows though  and there will be multiple items ordered on the same sheet and sometimes different product styles are ordered on the same form.

Avatar

Level 10

Hi,

If you have a look in the Object > Binding palette, you will see how I have specified values for each of the objects in the dropdown.

Parallels Desktop1.png

When you script for the .rawValue of the dropdown, you get the specified value.

Hope that helps,

Niall