This script is called when the user changes the value of a custom option setting (which is defined in an Options.Settings script) in the Options dialog. It allows you to ensure the value entered by the user is valid.

Parameters
A reference to the Stonefield Query Application object, the Registry key for the custom option as defined in the Options.Settings script, and the value entered by the user.

Return Value
The text of an error message if the value is invalid or an empty string if it is valid.

Example
Here's an example that ensures the directory setting indicating the location of the AR data is valid.

Visual FoxPro

lparameters toApplication as SQApplication, tcKey, tuValue
local lcMessage
lcMessage = ''
if tcKey = 'AR Location' and not file(tuValue + 'AR.DBF')
  lcMessage = 'That directory does not contain the AR data file.'
endif
return lcMessage

VBScript

function Main(Application, Key, Value)
dim fso
set fso = CreateObject("Scripting.FileSystemObject")
Main = ""
if Key = "AR Location" and not fso.FileExists(Value & "AR.DBF") then
  Main = "That directory does not contain the AR data file."
end if
end function

JavaScript

function Main(Application, Key, Value) {
var Message, fso ;
Message = '' ;
fso = new ActiveXObject('Scripting.FileSystemObject') ;
if (Key = 'AR Location' && ! fso.FileExists(Value + 'ar.dbf')) {
  Message = 'That directory does not contain the AR data file.'
}
return(Message) ;
}

See Also
Options.Changed | Options.Settings | Scripts