View Full Version : Compare date and insert % calculation of a value depending on result

12-01-2010, 08:08 AM
Having recently got Adobe Acrobat Pro I didnít expect to have to learn a new language, but there you go little did I know. Excel is easy compared to attempting JavaScript, but I guess I have to start somewhere.

I have managed to muddle my way through to a degree but I am now at a point where I require to add a script to an Adobe Form.

I wish to introduce a SURCHARGE of 10% to a SUBTOTAL value if the ordering DATE deadline has passed (as this will incur additional charges by us).

The SUBTOTAL and DATE fields exist, the new field is SURCHARGE where the script will reside.

I have the current system date inserted automatically on the form using:

var f = this.getField("DATE");
f.value = util.printd("dd/mmm/yyyy", new Date());

In Excel its relatively easy using the (if : else) commands, but js is just beyond me. I would be grateful if one of you learníed ones could spare me some of your knowledge.

CAPS - field names

Thanks in advance