[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 ValidGets()
 Validate all current GETs and position on failure.
------------------------------------------------------------------------------

 Syntax:

     ValidGets( [<aGetList>] ) --> <nFailedGet>

 Arguments:

     <aGetList> is an optional array containing GET objects.

 Returns:

     ValidGets() returns a number indicating the position of the first GET
     that failed validation.

 Description:

     ValidGets() performs a validation check on all current GETs.  If any
     of them fail the number of the first failed GET is returned, otherwise
     a zero (0) is returned.

     If ValidGets() returns a non-zero value SetGetPos() is set accordingly.

     ValidGets() is usually performed within the ACTION expression of BUTTON
     GET.

 Example:

     The following example uses ValidGets() with the OKAY BUTTON.

     LOCAL cName := CLIENT->NAME
     LOCAL nAge  := CLIENT->AGE
     LOCAL lBackDoor

     @ 10, 10 SAY "Name:" GET cName ORIGIN { || CLIENT->NAME }
     @ 11, 10 SAY "Age: " GET nAge ORIGIN { || CLIENT->AGE }
     @ 12, 10 BUTTON "Okay" WHEN Updated() ACTION ( ValidGets() == 0 )
     @ 12, 20 BUTTON "Abort" ACTION UndoGets()
     READ

     IF Updated() .AND. !__KillRead()

        lBackDoor := OrigChanged()

        IF !lBackDoor .OR. ;
           ( Alert( "Data Record Has Been Changed By Another User.;" + ;
             "Overwrite Their Changes?", { "No", "Yes" }, , .T. ) == 2 )

           WHILE !RLOCK() ; END

           CLIENT->NAME := cName
           CLIENT->AGE  := nAge

           COMMIT
           UNLOCK

        ENDIF

     ENDIF


 Files:  Library is CUACLIP.LIB.

See Also: ValidChk() EX1.PRG EX5.PRG
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson