These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Calculations and usage of Combo Boxes

djaxup
Registered: Jun 12 2008
Posts: 5

Hello!

First an apology, i am not a native english speaker, and i do not use an english version, so some terms may vary. I try to look them up, but please bear with me if they are wrong.

I have two (hopefully) simple questions first:

- how can i always round down a value? Say, Textfield A contains the value 5, and i want the rounded down half of that value (2) for Textfield B. How can i get that working?

- can i somehow fill a Textfield with the higher value of two other fields? Say Field A has the Value 4, Field B has the Value 3; i want the form to use the value of Field A then.

I suspect both can only be solved by using java. Sadly i do not know how to use that.

Now my question regarding the combo fields. I just want the selected combo box entry to distribute specific values into other form fields (all text fields). Is this possible, and if yes, how?

EDIT: one more question, is there an easy way to align Text Fields? I know how to copy them, but i still have to maneuver them by hand to the place they are supposed to be. This is tedious, but more importantly this is inaccurate. Is there some way to sort a lot of Text fields that are standing under each other to start at the exact same point?

Thanks in advance!
djax

My Product Information:
Acrobat Pro 7.0.9, Windows
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4308
>- how can i always round down a value? Say, Textfield A contains the value 5, and i want the rounded down half of that value (2) for Textfield B. How can i get that working?One can use JavaScirpt's "Math" objects various properties to obtain the "round", 'floor", "ceil", 'min", and "max" of a number or pair of numbers.

For your problem you do not want the "round" but the "floor" so you can obtain the closest lower integer.

var result = this.getField("Textfield A").value / 2;
event.value = Math.floor(result);

>- can i somehow fill a Textfield with the higher value of two other fields? Say Field A has the Value 4, Field B has the Value 3; i want the form to use the value of Field A then.One would use the 'max' property to obtain the larger of 2 items.

var A = this.getField("Field A").value;
var B = this.getField("Field B").value;
event.value = Math.max(A, B);

The above code assumes that the Export Value of the combo boxes are numbers.

>is there an easy way to align Text Fields? I know how to copy them, but i still have to maneuver them by hand to the place they are supposed to be. This is tedious, but more importantly this is inaccurate. Is there some way to sort a lot of Text fields that are standing under each other to start at the exact same point?In AcroForms one can set up a grid with the desired intervals and use the "Snap to grid" option.

George Kaiser

djaxup
Registered: Jun 12 2008
Posts: 5
Thank you for your answers! i'll try that out once my near complete form (took several hours...) wont give me the "problem that can't be solved" message. If anyone has a good tip regarding that one, i'd be more than happy.

Well now for the Combo Field thing. I noticed how flawed my description was.
Example: the list contains several types of cars, and i want the form to fill specific fields with values regarding these cars, like weight, speed... rats... it doesn't get any better. sry.
djaxup
Registered: Jun 12 2008
Posts: 5
the rounding down is working like a charm! Thanks.