Page tree
Skip to end of metadata
Go to start of metadata

The pjs.set() API allows you to change a field value. It is the same as an assignment operation, but allows you to refer to the field name dynamically.

Parameters
  1. Field name
  2. New value
Example
pjs.define("num0", { type: 'integer' });
pjs.define("num1", { type: 'integer' });
pjs.define("num2", { type: 'integer' });
pjs.define("num3", { type: 'integer' });
pjs.define("num4", { type: 'integer' });
pjs.define("num5", { type: 'integer' });

var numbers = [1, 10, 40, 50, 90, 99];
 
// transfer array of numbers to standalone fields
for (var i = 0; i < numbers.length; i++) {
  var fieldName = "num" + i;
  pjs.set(fieldName, numbers[i]);
}