編集フィールド - Validateメソッド
簡単なリポジトリフィールドとテーブル規則を使ってフィールドを検証します
編集フィールド (PRIM_MD.EditField) のメンバ
パラメータ
名前 | タイプ | データタイプ | 記述 |
|---|---|---|---|
Valid | *Result (任意) | ブール値 | フィールドが妥当性規則を渡す場合、TRUEを返します。 |
Operation | *Input | 列挙 | フィールド検証の対象となるオペレーション(挿入、更新、削除) |
Table | *Input (任意) | 検証に使用されるテーブル |
詳細
Validate メソッドにより、VIsual LANSA Web ランタイムの 編集 フィールド に対し、テーブルやフィールド規則が使用できるようになります。
検証処理は、挿入、更新、削除時の検証に利用できます。
valid が FALSE で返された場合、フィールドの HasError プロパティに TRUE が設定されます。
LANSA テーブルに対し検証するには、テーブル名に接頭辞 '#' が必要です。
この Validate メソッドには、複雑なロジックや検索規則は導入されていません。
例
以下の例では、xEmployeeSurname の挿入、更新、削除時に xEmployee テーブルで検証を行っています。
xEmployeeSurname は、簡単なロジックを使って、フィールドが空でないことを検証します。
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) Parent(#Layout1) Row(#Layout1Row1) Sizing(None) Flow(Down)
Define_Com Class(#PRIM_TBLO.Item) Name(#Layout1Item5) Alignment(TopLeft) Column(#Layout1Column1) Manage(#EmployeeSurname) Parent(#Layout1) Row(#Layout1Row1) Sizing(None) Flow(Down)
Define_Com Class(#xEmployeeSurname.EditField) Name(#EmployeeSurname) 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)
#EmployeeSurname.Validate( Insert #xEmployee )
Endroutine
Evtroutine Handling(#Update.Click)
#EmployeeSurname.Validate( Update #xEmployee )
Endroutine
Evtroutine Handling(#Delete.Click)
#EmployeeSurname.Validate( Delete #xEmployee )
Endroutine
End_Com