Subject Re: Field validation in grid
From Akshat Kapoor <akshat.kapoor@kapoorsons.in>
Date Tue, 10 Aug 2021 11:44:37 +0530
Newsgroups dbase.getting-started

Good Morning Milind,

> Scenerio:
> I am in grid.
> I want to validate a field say a date field D1. Validation is D1 > date() with error message when cursor is leaving field or record.
> I want cursor to stay in filed till  feild value satisifies the validation condition
>
> Code is something like this
> function editorControl_onLostFocus()
>        local lRet
>        lRet = false
>        if this.value < date()
>         lRet = false // Allow cancel
>         this.validErrorMsg := "Past Date NOT allowed"
>         else
>         lRet = true
>         endif
> return lret
>
>
> Any suggestion ?
>
> I used various ways usingevents like onlostfocus,valid for field
> At row  level rowset_canEdit()

Just to expand what Ken has already said.

I have made it a principal not to allow editing in Grid.

I have allowed editing in Grid in only 1 case and in that case also the
table is a temp table from where data is inserted into main table AFTER
validation.

Regards
Akshat