Multiply a field value by a set value

Previous topic - Next topic


I'm hoping to create a PDF order form which automatically calculates a price if the user enters a quantity.

The quantity field is named q1 and the field for the calculated price is named p1.

I've tried adding a 'custom calculation script' to the p1 field. Unfortunately, I'm not very familiar with JavaScript, and I think I might be doing something completely wrong as the editor's 'OK' button is always greyed out. For instance, I tried this:

if (this.getField('q1').value) {
this.getField('t1').value = this.getField('q1').value * 7.5;

Any help would be much appreciated!