LoginSignup
4
5

More than 5 years have passed since last update.

TreeFrogのバリデーション一覧

Last updated at Posted at 2014-06-30

TreeFrogに用意されているバリデーションです。

Required

入力必須


setRule("title", Tf::Required, true, "タイトルは入力必須です。");

MaxLength

最大文字数

setRule("title", Tf::MaxLength, 200, "タイトルは200文字以下である必要があります。");

MinLength

最小文字数

setRule("title", Tf::MinLength, 5, "タイトルは5文字以上である必要があります。");

IntMax

最大整数

setRule("title", Tf::IntMax, 10, "タイトルは10以下である必要があります。");

IntMin

最小整数

setRule("title", Tf::IntMin, 1, "タイトルは1以上である必要があります。");

DoubleMax

最大実数

setRule("title", Tf::DoubleMax, 9.9, "タイトルは9.9以下である必要があります。");

DoubleMin

最少実数

setRule("title", Tf::DoubleMin, 1.1, "タイトルは1.1以上である必要があります。");

EmailAddress

メールアドレス

setRule("title", Tf::EmailAddress, "タイトルは正しいメールアドレスではありません。");

Url

URL

setRule("title", Tf::Url, "タイトルは正しいURL形式ではありません。");

Date

日付

setRule("title", Tf::Date, "タイトルは正しい日付ではありません。");

Time

時刻

setRule("title", Tf::Time, "タイトルは正しい時刻ではありません。");

DateTime

日時

setRule("title", Tf::DateTime, "タイトルは正しい時刻ではありません。");

Pattern

正規表現

setPatternRule("title", QRegExp("[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}"), "タイトルは正しいIPアドレスではありません。");

動的なケース

bool FooValidator::validate(const QVariantHash &hash) を使用する。

4
5
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
4
5