Article ID: 10134
HOWTO: Prevent recursion when setting the value of an element from its ValueChanged script.
HOWTO
Applies To: ITScriptNet V1/V2
Setting the value of an element from within the ValueChanged script of an element will cause the ValueChanged script to execute again, and can lead to a recursion problem that can crash the ITScriptNet client.
DETAILS
To resolve this problem, either do not change the value of an element from within a ValueChanged script, or add a flag to prevent recursion. Here is a sample using such a flag to prevent recursion. For example, assume a combo box that you want to force to a value of ‘2’. Your on value changed script could look like the following:
$this.combobox1$ = “2”
This script may cause the recursion crash detailed above. However, adding a recursion flag as shown will prevent the problem:
if (@recurse@ <> 1)
   @recurse@ = 1
   $this.combobox1$ = “2”
   @recurse@ = 0
endif
This article last updated: 1/1/2009 12:00:00 AM
Please help us improve the Knowledge Base by rating this article.
    © 1997-2026 Z-Space Technologies - a BCA Innovations Company - All rights reserved