SBM JavaScript Library Guide → Reference → Event Methods → AddSectionCallback
Adds a callback that is invoked when a section is expanded or collapsed.
| Name | Type | Description |
|---|---|---|
| objname | String | The name of the section. |
| callback | Function | The function to be invoked when the section is expanded or collapsed. |
| expanded | Boolean | Whether to invoke the callback when the section is expanded or collapsed. If true, the callback is invoked when the user expands a section. |
| Result | Value |
|---|---|
| (none) | |
This example registers a named function to be called when a section is expanded or collapsed:
function customSectionCallback()
{
if ( IsFieldEmpty( "Problem" ) )
{
ShowErrorDiv( true, "A problem entry is required" );
}
else
{
ShowErrorDiv( false );
}
}
AddSectionCallback( "ProblemsSection", customSectionCallback, false );
Callbacks are invoked in the order in which they are added. This callback can be used to perform validation or other data verification. If you want to display a field validation error, call MakeFieldInvalid from this callback so that any required or invalid field errors are automatically processed.
Copyright © 2007–2015 Serena Software, Inc. All rights reserved.