AddSubmitCallback

Adds a callback that is invoked before the page is submitted.

Parameters

Name Type Description
callback Function The function to be invoked before the page is submitted.

Return Value

Result Value
true Continue processing other submit callbacks. If a function does not return a value, it is assumed to be "true".
false Stop processing other submit callbacks and cancel the submit operation.

Example

This example registers a named function to be called before the page is submitted:

function customSubmitCallback()
{
    // Prevent submit if Description field is empty
    if ( IsFieldEmpty( "Description" ) )
    {
         ShowErrorDiv( true, "A description is required" );
         return false;
    }
    else
    {
         ShowErrorDiv( false );
         return true;
    }
}

AddSubmitCallback( customSubmitCallback );

Comments

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 and return "true" from this callback so that any required or invalid field errors are automatically processed.