PRIM_DLG - Validate Method

Uses simple repository field and table rules to validate field

Member of PRIM_DLG (PRIM_DLG)

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)
File*Input (Optional)PRIM_OBJTTable for field to be validated against

Details

The Validate method allows for fields contained in Dialog to be validated against file and field rules.

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 fields in the Dialog being validated against the xEmployee table.
Begin_Com Role(*EXTENDS #PRIM_WEB) Theme(#SYS_THEME)

    Define_Com Class(#PRIM_TBLO) Name(#Layout1)
    Define_Com Class(#PRIM_TBLO.Row) Name(#Layout1Row1) Parent(#Layout1)
    Define_Com Class(#PRIM_TBLO.Column) Name(#Layout1Column1) Parent(#Layout1)
    Define_Com Class(#PRIM_TBLO.Item) Name(#Layout1Item1) Alignment(TopLeft) Column(#Layout1Column1) Manage(#xEmployeeIdentification) Parent(#Layout1) Row(#Layout1Row1) Sizing(FitToWidth) Flow(Down) Marginleft(8) Marginright(8) Margintop(8)
    Define_Com Class(#PRIM_TBLO.Item) Name(#Layout1Item2) Alignment(TopLeft) Column(#Layout1Column1) Manage(#xEmployeeSurname) Parent(#Layout1) Row(#Layout1Row1) Sizing(FitToWidth) Flow(Down) Marginleft(8) Marginright(8) Margintop(8)
    Define_Com Class(#PRIM_TBLO.Item) Name(#Layout1Item3) Alignment(TopLeft) Column(#Layout1Column1) Manage(#xEmployeeGivenNames) Parent(#Layout1) Row(#Layout1Row1) Sizing(FitToWidth) Flow(Down) Marginleft(8) Marginright(8) Margintop(8)
    Define_Com Class(#PRIM_TBLO.Item) Name(#Layout1Item4) Alignment(TopLeft) Column(#Layout1Column1) Manage(#xEmployeeStartDate) Parent(#Layout1) Row(#Layout1Row1) Sizing(FitToWidth) Flow(Down) Marginleft(8) Marginright(8) Margintop(8)
    Define_Com Class(#PRIM_TBLO.Item) Name(#Layout1Item5) Alignment(TopLeft) Column(#Layout1Column1) Manage(#ButtonValidate) Parent(#Layout1) Row(#Layout1Row1) Sizing(FitToWidth) Flow(Down) Marginleft(8) Marginright(8) Margintop(8)

    Define_Com Class(#PRIM_DLG) Name(#Dialog) Width(360) Height(600) Layoutmanager(#Layout1) Autoclose(True)
    Define_Com Class(#xEmployeeIdentification.EditField) Name(#xEmployeeIdentification) Parent(#Dialog) Displayposition(1) Tabposition(1)
    Define_Com Class(#xEmployeeSurname.EditField) Name(#xEmployeeSurname) Parent(#Dialog) Displayposition(2) Tabposition(1)
    Define_Com Class(#xEmployeeGivenNames.EditField) Name(#xEmployeeGivenNames) Parent(#Dialog) Displayposition(4) Tabposition(1)
    Define_Com Class(#xEmployeeStartDate.DateTimeField) Name(#xEmployeeStartDate) Parent(#Dialog) Displayposition(5) Tabposition(1)
    Define_Com Class(#prim_md.FlatButton) Name(#ButtonValidate) Parent(#Dialog) Displayposition(5) Tabposition(5) Caption('Validate')

        Evtroutine Handling(#COM_OWNER.Initialize)

            #Dialog.show

        Endroutine

        Evtroutine Handling(#ButtonValidate.Click)

            #Dialog.Validate( Update #xEmployee )

        Endroutine

End_Com

See also

All Component Classes

Technical Reference

V14SP2 April 2018