Skip to content

Commit

Permalink
Item11303: backend validation of multi email
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk/FormPlugin@13492 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
ArthurClemens authored and ArthurClemens committed Dec 20, 2011
1 parent 21b95ed commit e66d6d5
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions lib/Foswiki/Plugins/FormPlugin/Validate/BackendValidator.pm
Expand Up @@ -367,6 +367,31 @@ sub validate_email {
=cut

sub validate_multiemail {
my ( $name, $value ) = @_;

use Foswiki::Plugins::FormPlugin::Validate::Address qw(valid);

my @addresses = split( /\s*[[\s,;]]*\s*/, $value );
my $isValid = 0;

foreach my $address (@addresses) {
print STDERR "$address:" . valid($address) . "\n";
$isValid ||= valid($address);
}

my $message =
$isValid
? ''
: Foswiki::Plugins::FormPlugin::Validate::ValidationInstruction::parseMessage(
$name);
return ( $isValid, $message );
}

=pod
=cut

sub validate_url {
my ( $name, $value ) = @_;

Expand Down

0 comments on commit e66d6d5

Please sign in to comment.