PRIM_MD.DropdownField - Validate Method

Uses simple repository field and table rules to validate field

Member of PRIM_MD.DropdownField (PRIM_MD.DropdownField)

Parameters

NameTypeData TypeDescription
Valid*Result (Optional)BooleanReturns true if field passes the validation rules
Operation*InputEnumerationThe operation for the field to be validated against(insert, update and delete)
Table*Input (Optional)PRIM_OBJTTable to be used for validation

Details

The Validate method allows for the use of table and field rules to be used for Dropdown Fields.

Validate operation allows for the validation usage on insert, update and deletion.

If valid is returned as false the field property HasError will be set to true.

Validating against a LANSA table requires the table name to be prefixed with '#'.

Complex logic and look up rules are not implemented for use in the validate method.

Example

This example shows the validating EmployeeGender against the xAccident table for insert, update and deletion.
    
xEmployeeGender uses a list check to validate values are Male, Female or NoDisclose.
Begin_Com Role(*EXTENDS #PRIM_WEB) Theme(#SYS_THEME) Layoutmanager(#Layout1)

    Define_Com Class(#PRIM_TBLO) Name(#Layout1)
    Define_Com Class(#PRIM_TBLO.Row) Name(#Layout1Row1) Displayposition(1) Parent(#Layout1)
    Define_Com Class(#PRIM_TBLO.Column) Name(#Layout1Column1) Displayposition(1) Parent(#Layout1)
    Define_Com Class(#PRIM_TBLO.Item) Name(#Layout1Item1) Alignment(TopLeft) Column(#Layout1Column1) Manage(#Insert) Parent(#Layout1) Row(#Layout1Row1) Sizing(None) Flow(Down)
    Define_Com Class(#PRIM_TBLO.Item) Name(#Layout1Item2) Alignment(TopLeft) Column(#Layout1Column1) Manage(#Update) Parent(#Layout1) Row(#Layout1Row1) Sizing(None) Flow(Down)
    Define_Com Class(#PRIM_TBLO.Item) Name(#Layout1Item3) Alignment(TopLeft) Column(#Layout1Column1) Manage(#Delete) Parent(#Layout1) Row(#Layout1Row1) Sizing(None) Flow(Down)
    Define_Com Class(#PRIM_TBLO.Item) Name(#Layout1Item4) Alignment(TopLeft) Column(#Layout1Column1) Manage(#EmployeeGender) Parent(#Layout1) Row(#Layout1Row1) Sizing(None) Flow(Down)
    Define_Com Class(#xEmployeeGender.SpinEditField) Name(#EmployeeGender) Displayposition(1) Left(0) Parent(#COM_OWNER) Tabposition(1) Top(0) Width(505)
    Define_Com Class(#PRIM_MD.FlatButton) Name(#Delete) Caption('Validate on Delete') Parent(#COM_OWNER) Displayposition(4) Tabposition(4) Top(147) Left(0) Width(513)
    Define_Com Class(#PRIM_MD.FlatButton) Name(#Update) Caption('Validate on Update') Parent(#COM_OWNER) Displayposition(3) Tabposition(3) Top(111) Left(0) Width(513)
    Define_Com Class(#PRIM_MD.FlatButton) Name(#Insert) Caption('Validate on Insert') Parent(#COM_OWNER) Displayposition(2) Tabposition(2) Top(75) Left(0) Width(513)

        Evtroutine Handling(#Insert.Click)

            #EmployeeGender.Validate( Insert #xEmployee ) 

        Endroutine

        Evtroutine Handling(#Update.Click)

            #EmployeeGender.Validate( Update #xEmployee ) 

        Endroutine

        Evtroutine Handling(#Delete.Click)

            #EmployeeGender.Validate( Delete #xEmployee ) 

        Endroutine
End_Com

See also

All Component Classes

Technical Reference

V14SP2 2018