0
0

【OutSystems】 入力フォームで未来の日付を入れた場合にエラーを表示させる

Posted at

未来の日付を入力した場合、そのまま登録されてしまわないようにするには

誕生日に未来の日付を入力した際、登録ができないように制御します。

image.png

エンティティ
image.png

Saveロジック
image.png

① If文

ProfileForm.Record.Profile.DateOfBirth > CurrDate()

ProfileFormのDate Of Birthが現在の日付よりも先であれば
と設定。
ProfileFormはFormウィジェットにProfileエンティティを紐づけたもの。
image.png

image.png

② True(現在の日付よりも先)の場合

Profile_DateOfBirth.Valid = False

ProfileFormのDate Of Birthは違いますよ
と設定。

image.png

③ データを検証

not ProfileForm.Valid?

ProfileFormにユーザーが正しい日付を入力していないですか?
という設定。
image.png

FormウィジェットのValidプロパティにアクセスすることにより、クライアントアクションでデータを検証している。

image.png

ProfileFormにユーザーが正しい日付を入力していないですか?

->はい、正しい日付を入力していない。
正しい日付を入力していない (未来の日付を入力) 場合は、右に進み (True)、フィードバックメッセージ (「日付が正しくありません」など) を表示させEnd。

->いいえ、正しい日付を入力している。
正しい日付を入力している場合は下に進み (False)、Profileをアップデートして、フィードバックメッセージ (「登録しました。」)などを表示させてEnd。

image.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0