Scripting Form Fields with the Onchange field

Onchange attribute of a Field
Description: code that is executed when the value of the field is changed in the Form Edit screen.
Where to enter code: Template Field Edit in web account / Onchange field
Syntax: you can access the new value of the field in the ‘value’ variable. The ‘formid’ variable contains the unique identifier of the current form. The code must return true or 1 for the field value to be updated.

Example: Change the end date field F2 based on the value of start date field F1. Enter the following script in the Onchange field:

var d = new Date(new Number(value));
var value2 = d.setFullYear(d.getFullYear()+1);
_valueObj[‘F1’] = value;
_valueObj[‘F2’] = value2;
var values = JSON.stringify(_valueObj);
Query.updateId(“Forms.forms”, formid, ‘value’, values);
History.reload();
return 0;

Signature custom field

You can now add a Signature field to any data item, e.g. a  Project, Job, Task,..

Example in the Jobs web app, goto Options from the left pane menu, and click on the Custom Fields tab. Add a new Custom field and select the Type “signature”.

When you edit a Job on a mobile device, the Signature field will appear, and the user can enter a freehand signature on screen. The picture of the signature is displayed in the Job view screen, both on the mobile and on the web.