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

Help with JavaScript Editor in Acrobat 8

Suedesign
Registered: Jul 22 2008
Posts: 19
Answered

Hi everyone, I've been searching this community for some guidance on a challenge I'm currently facing. I just couldn't find nor understand how to do this so your help would be appreciated.

I am trying to create code within the Custom Calculation Script in Acrobat 8 that would allow the following:

Price Per Roll:

1-11 = $10.95 12-35 = $9.65 36+=$9.30

I have a text field "Qty/Rolls" and then a Text Field for "Total"

I need to somehow create an if/then statement whereas, if someone types in a quantity of less than 12 - then it would be that quantity * $10.95

If someone types in a quantity that is between 12-35, then it would be that quantity * $9.65, etc.

Is this possible to do/create?

Thanks much.

My Product Information:
Acrobat Standard 8.0, Macintosh
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
For the custom calculation script for the "Total" field:

event.value = ''; // clear field
// more than 0 rolls and less than 12 rolls
if (this.getField("Qty/Rolls").value > 0 & this.getField("Qty/Rolls").value < 12) {
event.value = 10.95 * this.getField("Qty/Rolls").value;
}
// more than 11 rolls and less than 35 rolls
if (this.getField("Qty/Rolls").value > 11 & this.getField("Qty/Rolls").value < 35) {
event.value = 9.95 * this.getField("Qty/Rolls").value;
}
// more than 34 rolls
if (this.getField("Qty/Rolls").value > 34) {
event.value = 9.30 * this.getField("Qty/Rolls").value;
}

The script could be simplified with field validation by not allowing an entry of less than zero rolls/

George Kaiser

Suedesign
Registered: Jul 22 2008
Posts: 19
Thank you so much for taking the time to do this for me. I spent so many hours trying to figure it out. I haven't tried it yet but I'm sure what you wrote will be successful.

Again, many thanks.