https://github.com/mackee/nephia-plugin-formvalidator-lite
FormValidator::Lite plugin for Nephia
https://github.com/mackee/nephia-plugin-formvalidator-lite
Last synced: about 1 year ago
JSON representation
FormValidator::Lite plugin for Nephia
- Host: GitHub
- URL: https://github.com/mackee/nephia-plugin-formvalidator-lite
- Owner: mackee
- License: other
- Created: 2013-07-02T10:06:56.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2019-12-04T16:35:00.000Z (over 6 years ago)
- Last Synced: 2025-04-01T12:52:54.838Z (about 1 year ago)
- Language: Perl
- Size: 160 KB
- Stars: 0
- Watchers: 0
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: Changes
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/mackee/Nephia-Plugin-FormValidator-Lite)
# NAME
Nephia::Plugin::FormValidator::Lite - FormValidator::Lite plugin for Nephia
# SYNOPSIS
use Nephia plugins => [qw/FormValidator::Lite/];
post '/form' => sub {
my $res = form(
first_name => [qw/NOT_NULL/],
last_kana => [qw/NOT_NULL/],
mail => [qw/NOT_NULL EMAIL/],
);
# Alias name of params. This use in error messages.
# Default is param key.
$res->set_param_message(
first_name => 'First name',
last_name => 'Last name',
mail => 'Mail address'
);
# check error
if ($res->has_error) {
return {
template => 'index.html',
error_message => $res->get_error_messages, # print errors
};
}
else {
my $req = req;
return {
template => 'confirm.html',
form => {
name => $req->('param'),
name_kana => $req->('name_kana'),
mail => $req->('mail'),
}
};
}
};
# in etc/conf/common.pl
+{
'Plugin::FormValidator::Lite' => {
function_message => 'en',
constants => [qw/Email/]
}
};
# DESCRIPTION
Nephia::Plugin::FormValidator::Lite is a [FormValidator::Lite](http://search.cpan.org/perldoc?FormValidator::Lite) binding for Nephia.
# SEE ALSO
[Nephia](http://search.cpan.org/perldoc?Nephia)
[FormValidator::Lite](http://search.cpan.org/perldoc?FormValidator::Lite)
# LICENSE
Copyright (C) MACOPY.
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
# AUTHOR
MACOPY