Name

filter — value passes through specified filter unmodified

DESCRIPTION

Verification of the form field value succeeds if it passes the specified filter unaltered.

EXAMPLES

Example: filter

FORM_FIELD_NAME=filter alpha "The value contains non-alpha characters"

Example: filter

FORM_FIELD_NAME=filter name "Name entered is not in format 'First Last'"

NOTES

For a list of all possible filters, see Interchange Reference Pages: Filters. Filters that unconditionally modify input data are generally not suitable for use with this order check; the data is always changed so it always fails the validation.

AVAILABILITY

filter is available in Interchange versions:

4.6.0-5.9.0 (git-head)

SOURCE

Interchange 5.9.0:

Source: code/OrderCheck/filter.oc
Lines: 35


# Copyright 2005-2007 Interchange Development Group and others
# 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.  See the LICENSE file for details.
# 
# $Id: filter.oc,v 1.3 2007-03-30 23:40:48 pajamian Exp $

CodeDef filter OrderCheck 1
CodeDef filter Description Passes filter unchanged
CodeDef filter Routine <<EOR
sub {    
my ($ref, $name, $value, $code) = @_;
my $message;
my $filter;

$code =~ s/\\/\\\\/g;
if($code =~ /(["']).+?\1$/) {
  my @code = Text::ParseWords::shellwords($code);
  $message = pop(@code);
  $filter = join " ", @code;
}
else {
  ($filter, $message) = split /\s+/, $code, 2;
}

my $test = Vend::Interpolate::filter_value($filter, $value, $name);
if($test ne $value) {
  $message ||= errmsg("%s caught by filter %s", $name, $filter);
  return ( 0, $name, $message);
}
return (1, $name, '');
}
EOR

AUTHORS

Interchange Development Group

SEE ALSO

Filter(7ic)

DocBook! Interchange!