1Workflow::Validator::HaUssReerquCiornetdrFiibeultde(d3W)PoerrklflDoowc:u:mVeanltiadtaitoonr::HasRequiredField(3)
2
3
4

NAME

6       Workflow::Validator::HasRequiredField - Validator to ensure certain
7       data are in the context
8

VERSION

10       This documentation describes version 1.61 of this package
11

SYNOPSIS

13        # Validator is created automatically when you mark a field as
14        # 'is_required=yes' in the action, such as:
15
16        <action name="CreateUser">
17           <field name="username"
18                  is_required="yes"
19                  source_class="App::Fied::ValidUsers"/>
20           ...
21

DESCRIPTION

23       This is a simple validator to ensure that each of the fields you have
24       marked with the 'is_required' property as 'yes' are indeed present
25       before the associated action is executed.
26
27       for instance, given the configuration:
28
29        <action name="CreateUser">
30           <field name="username"
31                  is_required="yes"/>
32           <field name="email"
33                  is_required="yes"/>
34           <field name="office">
35        </action>
36
37       An action executed with such a context:
38
39        my $wf = FACTORY->get_workflow( $id );
40        $wf->context( username => 'foo' );
41        $wf->context( office => 'Ottumwa' );
42        $wf->execute_action( 'CreateUser' );
43
44       Would fail with a message:
45
46        The following fields require a value: email
47
48       You normally do not need to configure this validator yourself. It gets
49       generated automatically when the Action configration is read in.
50       However, if you do need to create it yourself:
51
52        <action name='Foo'>
53           <validator name="HasRequiredField">
54              <arg value="fieldOne"/>
55              <arg value="field_two"/>
56           </validator>
57        <?action>
58
59       Note that we do not try to match the value in the context against a set
60       of known values or algorithm, just see if the value is defined -- using
61       the Perl notion for defined rather than true/false, which means '0' and
62       the empty string will both be valid.
63
64   METHODS
65       validate
66
67       Validates whether a given set of required fields are defined.
68
69       Takes two parameters: a workflow object and an array of names of
70       fields.
71
72       The provided fields are matched against the workflow in question and
73       Workflow::Exception's are thrown in case of missing fields.
74
76       Copyright (c) 2003-2022 Chris Winters. All rights reserved.
77
78       This library is free software; you can redistribute it and/or modify it
79       under the same terms as Perl itself.
80
81       Please see the LICENSE
82

AUTHORS

84       Please see Workflow
85
86
87
88perl v5.36.0                      2023-W0o1r-k2f0low::Validator::HasRequiredField(3)
Impressum