4 Replies Latest reply on Sep 27, 2012 3:18 PM by gkaiseril

# need help with creating a formula for percentages

I am creating a fillable form for subcontractors to submit change requests. One of the sections on the form is for materials. Most subs will charge a markup which is a small percentage of the actual cost. Obviously, both amounts are variables. I want the subs to be able to enter the material cost in field 1, the markup percentage in field two, and then have field three calculate the dollar amount for them. Is this possible? Btw, I'm clueless on this, it's my first attempt at an adobe form. Thanks!!!

• ###### 1. Re: need help with creating a formula for percentages

Add the following script in field 3 onfocus.

var a=this.getfield("field1").value;

var b=this.getfield("field2").value;

var c=a*b/100; (calculation only for example; include your calculation)

this.getfield("field3").value=c;

Also please set the properties for filed 3 like mentione below:

format                  : Number

Decimal places     : 2

Currency Symbols : Dollor (\$)

• ###### 2. Re: need help with creating a formula for percentages

A more standard way is to use something like the following as the third field's custom Calculate script:

// Custom calculate script

(function () {

// Get the field values, as numbers

var v1 = +getField("price").value;

var v2 = +getField("markup_percentage").value;

// Calculate the value of this field

event.value = v1 * (1 + v2 / 100);

})();

This is assuming that a percentage of 20% is entered by the user as 20, as opposed to 0.2 or something else. Change the field values to match the actual fields in your form.

If the markup field is blank or zero, the total will simply be the same as the price value.

• ###### 3. Re: need help with creating a formula for percentages

I really need help too!!!

I'm creating a form that needs to tally the score (on a scale of 1-5) given in several text fields, divide it by the total score possible (55) and display it at the bottom of the page as a percentage. Can anyone please please help me?! I'm a javascript dunce. I tried applying the above scripts but to no avail. Any assitance would be much appreciated.