Author Topic: Multiply a field value by a set value  (Read 82 times)

Bleep

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
  • Scribus User
Multiply a field value by a set value
« on: August 02, 2017, 01:30:46 am »
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:

Code: [Select]
if (this.getField('q1').value) {
this.getField('t1').value = this.getField('q1').value * 7.5;
}

Any help would be much appreciated!