Hello. I'd like to use the ESQL taglib inside a PerForm validation subroutine, but it needs $document and the like.
Example:
<xsp:logic>
sub validate_domain {
my ($ctxt, $value) = @_;
# Strip leading and trailing whitespace.
$value =~ s/^\s*//;
$value =~ s/\s*$//;
# The domain must not be null.
die 'The domain can not be blank, or all spaces' unless $value;
# The domain must be the correct length and contain only valid characters.
$value =~ m/^[0-9a-zA-Z.]$/ || die 'The userid can contain only letters,
digits, and the period (".") character';
# The domain must exist in the database.
<sql:connection>
<sql:driver>mysql</sql:driver>
<sql:dburl>dbname=<xsp:expr>$db_name</xsp:expr></sql:dburl>
<sql:username><xsp:expr>$db_user</xsp:expr></sql:username>
<sql:password><xsp:expr>$db_pass</xsp:expr></sql:password>
<sql:execute-query>
<sql:query>
SELECT *
WHERE domain = '<xsp:expr>$value</xsp:expr>'
</sql:query>
<sql:no-results>
# Maintain with the uid validator.
die "The domain does not exist";
</sql:no-results>
</sql:execute-query>
</sql:connection>
}
</xsp:logic>
Any help would be appriciated.
-TT
pgp00000.pgp
Description: PGP signature
