Skip to main content

booleanRule

booleanRule は、真偽値入力項目のバリデーションルールを生成するための関数です。この関数では、必須項目かどうか、カスタムルール名を指定できます。

シグネチャ

booleanRule(required: boolean, customRuleName?: string): BooleanValidationRule

引数

引数名必須説明
requiredboolean入力項目が必須項目かどうかを指定します。
customRuleNamestringカスタムバリデーションルールの名前を指定します。

返り値

boolean 型のバリデーション定義情報(必須項目かどうか、カスタムルール名など)を保持する BooleanValidationRule クラスのインスタンスを返します。

使用例

const view = useCsView(
{
isConfirmed: useCsInputCheckboxItem(
"確認済み",
useInit(false),
booleanRule(true, "確認済み")
),
},
{
customValidationRules: myCustomValidationRules, // 「確認済み」のカスタムバリデーションルールを定義済み
}
);