The currentcomponent() function returns an integer indicating which component of a composite the focus moved from.
currentcomponent()
• None
Integer
The currentcomponent() function is used in the pre, change and post scripts for composite fields for which the pre, change and post scripts will be run for each component, as well as the composite as a whole. The Call Component Scripts option in the Data Type Definition window specifies whether scripts will run for components.
The value returned from the currentcomponent() function specifies which component of the composite the focus just moved from. The following table shows which scripts run and the value returned by the currentcomponent() function when a user moves into, through, and out of a three-component composite field.
User action |
Scripts run |
Value returned |
---|---|---|
Move into the first component. |
Pre script (for the entire field) Pre script (for the first component) |
0 1 |
Change the first component and tab into the second. |
Change script (for the first component) Post script (for the first component) Pre script (for the second component) |
1 1 2 |
Change the second component and tab into the third. |
Change script (for the second component) Post script (for the second component) Pre script (for the third component) |
2 2 3 |
Change the third component and move out of the composite. |
Change script (for the third component) Post script (for the third component) Change script (for the entire field) Post script (for the entire field) |
3 3 0 0 |
Component scripts are useful for validating portions of the composite rather than validating the entire composite at once.