WITH THIS DIMENSION .aFieldRule[ 2,2] .aFieldRule[ 1,1] = ALLTRIM( .cAlias) + '.cProcedureId' .aFieldRule[ 2,1] = ALLTRIM( .cAlias) + '.cModeleID' .aFieldRule[ 1,2] = 'indiquer la <Procédure>' .aFieldRule[ 2,2] = 'indiquer le <Modèle>' ENDWITHThen comes the BeforeSave() method (table buffering in this case):
LOCAL lnCount, ; loSelect, ; lcCode, ; lcfield, ; lcMessage, ; lnNext, ; lnRetVal lnRetVal = .T. loSelect = CREATEOBJECT("cSelect", ALIAS( SELECT(0))) this.cGrid1.SetFocus() SELECT (THIS.cAlias) lnNext = GETNEXTMODIFIED(0) DO WHILE lnNext # 0 GO (lnNext) lnRetVal = .F. WITH THIS FOR lnCount = 1 TO ALEN( .aFieldRule, 1) lcfield = .aFieldRule[ lnCount, 1] lcMessage = .aFieldRule[ lnCount, 2] IF EMPTY( EVAL( lcfield)) AND ! DELETED() THISFORM.FindControl( lcfield, [Avant de sauvegarder, veuiller ] + lcMessage + [ s'il vous plaît.]) lnRetVal = .F. ELSE lnRetVal = .T. ENDIF IF ! lnRetVal EXIT ENDIF ENDFOR ENDWITH lnNext = GETNEXTMODIFIED(lnNext) IF ! lnRetVal EXIT ENDIF ENDDO RETURN lnRetValThe FindControl() method finds the offending control and shows it in red color.