.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "HTML::FormFu::Constraint::DBIC::Unique 3pm" .TH HTML::FormFu::Constraint::DBIC::Unique 3pm "2022-11-20" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" HTML::FormFu::Constraint::DBIC::Unique \- unique constraint for HTML::FormFu::Model::DBIC .SH "VERSION" .IX Header "VERSION" version 2.03 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& $form\->stash\->{schema} = $dbic_schema; # DBIC schema \& \& $form\->element(\*(Aqtext\*(Aq) \& \->name(\*(Aqemail\*(Aq) \& \->constraint(\*(AqDBIC::Unique\*(Aq) \& \->resultset(\*(AqUser\*(Aq) \& ; \& \& \& $form\->stash\->{context} = $c; # Catalyst context \& \& $form\->element(\*(Aqtext\*(Aq) \& \->name(\*(Aqemail\*(Aq) \& \->constraint(\*(AqDBIC::Unique\*(Aq) \& \->model(\*(AqDBIC::User\*(Aq) \& ; \& \& $form\->element(\*(Aqtext\*(Aq) \& \->name(\*(Aquser\*(Aq) \& \->constraint(\*(AqDBIC::Unique\*(Aq) \& \->model(\*(AqDBIC\*(Aq) \& \->resultset(\*(AqUser\*(Aq) \& ; \& \& \& or in a config file: \& \-\-\- \& elements: \& \- type: text \& name: email \& constraints: \& \- Required \& \- type: DBIC::Unique \& model: DBIC::User \& \- type: text \& name: user \& constraints: \& \- Required \& \- type: DBIC::Unique \& model: DBIC::User \& column: username .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Checks if the input value exists in a \s-1DBIC\s0 ResultSet. .SH "METHODS" .IX Header "METHODS" .SS "model" .IX Subsection "model" Arguments: \f(CW$string\fR # a Catalyst model name like 'DBIC::User' .SS "resultset" .IX Subsection "resultset" Arguments: \f(CW$string\fR # a \s-1DBIC\s0 resultset name like 'User' .SS "self_stash_key" .IX Subsection "self_stash_key" reference to a key in the form stash. if this key exists, the constraint will check if the id matches the one of this element, so that you can use your own name. .SS "id_field" .IX Subsection "id_field" Use this key to define reference field which consist of primary key of resultset. If the field exists (and \f(CW$self_stash_key\fR not defined), the constraint will check if the id matches the primary key of row object: .PP .Vb 6 \& \-\-\- \& elements: \& \- type: Hidden \& name: id \& constraints: \& \- Required \& \& \- type: Text \& name: value \& label: Value \& constraints: \& \- Required \& \- type: DBIC::Unique \& resultset: ControlledVocab \& id_field: id .Ve .SS "others" .IX Subsection "others" Use this key to manage unique compound database keys which consist of more than one column. For example, if a database key consists of \&'category' and 'value', use a config file such as this: .PP .Vb 7 \& \-\-\- \& elements: \& \- type: Text \& name: category \& label: Category \& constraints: \& \- Required \& \& \- type: Text \& name: value \& label: Value \& constraints: \& \- Required \& \- type: DBIC::Unique \& resultset: ControlledVocab \& others: category .Ve .SS "method_name" .IX Subsection "method_name" Name of a method which will be called on the resultset. The method is passed two argument; the value of the field, and the primary key value (usually `id`) of the record in the form stash (as defined by self_stash_key). An example config might be: .PP .Vb 9 \& \-\-\- \& elements: \& \- type: text \& name: user \& constraints: \& \- Required \& \- type: DBIC::Unique \& model: DBIC::User \& method_name: is_username_available .Ve .SS "\s-1SEE ALSO\s0" .IX Subsection "SEE ALSO" Is a sub-class of, and inherits methods from HTML::FormFu::Constraint .PP HTML::FormFu::FormFu .SH "AUTHOR" .IX Header "AUTHOR" Jonas Alves \f(CW\*(C`jgda@cpan.org\*(C'\fR .SH "LICENSE" .IX Header "LICENSE" This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.