GUI-based reading and value setting of form fields


To increase the convenience of forms, form fields can be assigned actions. These actions are called callbacks and can be edited in the form editor.
One example is a form for sending SMS. An SMS has a maximum length of 160 characters. After each entry in the "SMSText" text field, the "Remaining characters" form field, in which the remaining number of characters is displayed, should be updated. This behavior can be achieved with the following script in the callback of the text field:

// read value from textfield:
var text = helper.getFormValue("Send SMS", "SMSText");
// calculate remaining characters:
var rest = 160-text.length();
// set number of characters in form field:
helper.setFormValue("Send SMS", "Remaining characters", ""+rest);