[Tips] Clearing form variables
[image unavailable: Picture 30]Form variables are a good way to show data from multiple sources in modal popup forms. When the modal popup is shown, fill in the data from the various sources, setup custom value lists, and you have a fast way of re-purposing data to a new destination — without cluttering up your global variables list with single purpose variables.
This can add up to a lot of form variables that you will need to clear out the next time you show the modal form. Instead of clearing out each form variable individually, place the following code at the top of the form's onShow event:
// clear all form variables
for (var i = 0; i < allvariables.length; i++) {
forms.form_name_here[allvariables[i]] = null
}
This code snippet keeps doing its job no matter how many form variables you create, delete or modify.
Comments (3)