GUI-based reading and value setting of form fields
To extent the usability of forms it is possible to add certain actions to the form fields. These actions are named "callbacks", they can be edited within the forms editor.
We will discuss in brief a form to send SMS. A SMS has a maximum length of 160 characters. After each input to the text-field "SMSText" the form-field "Restzeichen" should be updated. The form-field "Restzeichen" indicates the remaing available characters within the SMS. The following script adds this functionality within the callback of the text-field:
// Lese den aktuellen Inhalt des Textfeldes aus
var text = helper.getFormValue("SMS versenden", "SMSText");
//Berechne die verbleibende Anzahl Zeichen
var rest = 160-text.length();
// Gebe die verbleibende Anzahl Zeichen aus
helper.setFormValue("SMS versenden", "Restzeichen", ""+rest);
var text = helper.getFormValue("SMS versenden", "SMSText");
//Berechne die verbleibende Anzahl Zeichen
var rest = 160-text.length();
// Gebe die verbleibende Anzahl Zeichen aus
helper.setFormValue("SMS versenden", "Restzeichen", ""+rest);