View - ClearErrors Method

Clears errors of fields in the view

Member of View (PRIM_VIEW)

Details

ClearErrors method will set all fields HasError property to false within the View.

Example

This example shows all fields having errors set using the Validation method.

Pressing the clear errors button will set the HasError property false for all fields and change their theme from error.
Begin_Com Role(*EXTENDS #PRIM_WEB) Theme(#SYS_THEME) Layoutmanager(#LayoutPage)
    Define_Com Class(#PRIM_TBLO) Name(#LayoutPage)
    Define_Com Class(#PRIM_TBLO.Row) Name(#LayoutPageRow1) Displayposition(1) Parent(#LayoutPage)
    Define_Com Class(#PRIM_TBLO.Column) Name(#LayoutpageColumn1) Displayposition(1) Parent(#LayoutPage)
    Define_Com Class(#PRIM_TBLO.Item) Name(#LayoutPageItem1) Column(#LayoutpageColumn1) Manage(#ViewContainer) Parent(#LayoutPage) Row(#LayoutPageRow1)
    Define_Com Class(#PRIM_TBLO) Name(#LayoutView)
    Define_Com Class(#PRIM_TBLO.Row) Name(#LayoutViewRow1) Parent(#LayoutView) Displayposition(1)
    Define_Com Class(#PRIM_TBLO.Column) Name(#LayoutViewColumn1) Parent(#LayoutView) Displayposition(1)
    Define_Com Class(#PRIM_TBLO.Item) Name(#LayoutViewItem1) Alignment(TopLeft) Column(#LayoutViewColumn1) Manage(#EmployeeIdentification) Parent(#LayoutView) Row(#LayoutViewRow1) Sizing(FitToWidth) Flow(Down) Marginleft(8) Marginright(8) Margintop(8)
    Define_Com Class(#PRIM_TBLO.Item) Name(#LayoutViewItem2) Alignment(TopLeft) Column(#LayoutViewColumn1) Manage(#EmployeeSurname) Parent(#LayoutView) Row(#LayoutViewRow1) Sizing(FitToWidth) Flow(Down) Marginleft(8) Marginright(8) Margintop(8)
    Define_Com Class(#PRIM_TBLO.Item) Name(#LayoutViewItem3) Alignment(TopLeft) Column(#LayoutViewColumn1) Manage(#EmployeeGivenNames) Parent(#LayoutView) Row(#LayoutViewRow1) Sizing(FitToWidth) Flow(Down) Marginleft(8) Marginright(8) Margintop(8)
    Define_Com Class(#PRIM_TBLO.Item) Name(#LayoutViewItem4) Alignment(TopLeft) Column(#LayoutViewColumn1) Manage(#EmployeeStartDate) Parent(#LayoutView) Row(#LayoutViewRow1) Sizing(FitToWidth) Flow(Down) Marginleft(8) Marginright(8) Margintop(8)
    Define_Com Class(#PRIM_TBLO.Item) Name(#LayoutViewItem5) Alignment(TopLeft) Column(#LayoutViewColumn1) Manage(#ButtonValidate) Parent(#LayoutView) Row(#LayoutViewRow1) Sizing(FitToWidth) Flow(Down) Marginleft(8) Marginright(8) Margintop(8)
    Define_Com Class(#PRIM_TBLO.Item) Name(#LayoutViewItem6) Alignment(TopLeft) Column(#LayoutViewColumn1) Manage(#ButtonClear) Parent(#LayoutView) Row(#LayoutViewRow1) Sizing(FitToWidth) Flow(Down)
    Define_Com Class(#PRIM_MD.ViewContainer) Name(#ViewContainer) Displayposition(1) Parent(#COM_OWNER) Tabposition(1) Height(800) Width(1200)
    Define_Com Class(#PRIM_View) Name(#View) Width(1200) Height(800) Layoutmanager(#LayoutView) Parent(#ViewContainer) Displayposition(1) Tabposition(1) Left(400)
    Define_Com Class(#xEmployeeIdentification.EditField) Name(#EmployeeIdentification) Displayposition(1) Tabposition(4) Parent(#View) Left(8) Top(8) Width(1184)
    Define_Com Class(#xEmployeeSurname.EditField) Name(#EmployeeSurname) Displayposition(2) Tabposition(3) Parent(#View) Left(8) Top(91) Width(1184)
    Define_Com Class(#xEmployeeGivenNames.EditField) Name(#EmployeeGivenNames) Displayposition(3) Tabposition(2) Parent(#View) Left(8) Top(174) Width(1184)
    Define_Com Class(#xEmployeeStartDate.DateTimeField) Name(#EmployeeStartDate) Displayposition(4) Tabposition(1) Parent(#View) Left(8) Top(257) Width(1184)
    Define_Com Class(#prim_md.FlatButton) Name(#ButtonValidate) Displayposition(5) Tabposition(6) Caption('Validate') Parent(#View) Left(8) Top(340) Width(1184)
    Define_Com Class(#prim_md.FlatButton) Name(#ButtonClear) Displayposition(6) Tabposition(5) Caption('Clear Errors') Parent(#View) Left(0) Top(376) Width(1200)

        Evtroutine Handling(#COM_OWNER.Initialize)

            #View.show

            #View.Validate( Update #xEmployee )

        Endroutine

        Evtroutine Handling(#ButtonValidate.Click)

            #View.Validate( Update #xEmployee )

        Endroutine

        Evtroutine Handling(#ButtonClear.Click)

            #View.ClearErrors

        Endroutine

End_Com

See also

All Component Classes

Technical Reference

V14SP2 2018