「開始」日付フィールドが「終了」日付フィールドと異なることを確認したい。だから私はこのドキュメントHTML::FormFu::Constraint::Callbackを流しています:
config.yml:
type: Text
name: to
label: To
constraints:
- type: DateTime
parser:
strptime: '%Y-%m-%d %H:%M:%S'
- type: Callback
callback: "check_date"
my_controller.pm:
sub check_date {
my ( $value, $params ) = @_;
return 1; //juste fel testing
}
sub index : Path :Args(0) :FormConfig('config.yml'){
..........
my $field = $form->get_element({type => 'Text', 'name' => 'to'});
$field->constraint({
type => 'Callback',
callback => \&check_date,
});
...........
}
しかし、関数「check_date」は検出されませんでした。