Highlighted

## Acrobat form calculation - javascript help required

Community Beginner ,
Oct 09, 2020

Copied

This form currently calculates contract value as price per m2 x floor area

but it needs to be:-

Price per m2 x floor area x minimum hire period

(The minimum hire period being 52)

Eg. Boarding accommodation of 5000 m2 should come out at £1,950,000 – £2,080,000

I have uploaded the file with notes showing current javascript code.

Any help much appreciated. I'm a Javascript novice so please be gentle 🙂

Hi, see if this is what you looking for:

I also input space in "Contract value" field between currency simbol so all fields with currency now look same.

TOPICS
PDF forms

Views

71

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

## Acrobat form calculation - javascript help required

Community Beginner ,
Oct 09, 2020

Copied

This form currently calculates contract value as price per m2 x floor area

but it needs to be:-

Price per m2 x floor area x minimum hire period

(The minimum hire period being 52)

Eg. Boarding accommodation of 5000 m2 should come out at £1,950,000 – £2,080,000

I have uploaded the file with notes showing current javascript code.

Any help much appreciated. I'm a Javascript novice so please be gentle 🙂

Hi, see if this is what you looking for:

I also input space in "Contract value" field between currency simbol so all fields with currency now look same.

TOPICS
PDF forms

Views

72

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 09, 2020 0
5 Replies 5
Engaged ,
Oct 09, 2020

Copied

Try to replace code in "requirements 15" field with the code below and see if that helps you:

var req1 = Number(this.getField("requirements 14").valueAsString);
var req2 = Number(this.getField("requirements 25").valueAsString);
var area = Number(this.getField("Floor Area").valueAsString);
var c1 = area*req1*52;
var c2 = area*req2*52;
event.value = util.printf("£%,0.0f",c1) + " - " + util.printf("£%,0.0f",c2);

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 09, 2020 1
Community Beginner ,
Oct 09, 2020

Copied

Hey. Nesa

Just tried that and it works perfectly. What a legend!

Thank you so much!!!

🙂

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 09, 2020 0
Community Beginner ,
Oct 21, 2020

Copied

Hi Nesa. Just when I thought this job was complete I have been asked to add two more fields 😞

Is it possible to expand the Javascript so that the floor area populates the delivery and installation and foundations fields? Both are based on floor area:-

Delivery calculation should be Floor area x 65 in £'s

Foundation calalculation should be Floor area x 70 in £'s

PDF here

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 21, 2020 0
Engaged ,
Oct 21, 2020

Copied

Hi, see if this is what you looking for:

I also input space in "Contract value" field between currency simbol so all fields with currency now look same.

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 21, 2020 1
LATEST
Community Beginner ,
Oct 21, 2020

Copied

Oh that's amazing. I can't thank you enough for your help on this.

Likes

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 21, 2020 0
Resources