On 7/19/2023 10:20 AM, Milind Nighojkar wrote: > Scenerio : To execute a common validation repitative code for an object in a form ? > > Can function / procedure be created in a form ? How to call that function ?
Add the code below the constructor:
class form ...
form constructor (details of the form, size, etc.)
all the objects on the form
usually a statement like:
form.rowset = ...
// add all your own code here:
function MyValidation
bReturn = true
// whatever you need to do
// set return to false if invalid
return bReturn
endclass
Then in the code in the form if you want to perform the validation
routine you can do it in things like an onLostFocus event handler, and
call: class::MyValidation() like:
if not class::MyValidation()
alert( "Something is not valid" )
this.focus()
endif
There are MANY ways to do things like this. If you haven't, you may want
to look at my books, and/or the dBASE Tutorial (see my signature block
below).