The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

HTML::Widget::Constraint - Constraint Base Class

SYNOPSIS

    my $c = $widget->constraint( $type, @names );
    $c->message('Validation error.');
    $c->names(@names);
    $c->not(1);

DESCRIPTION

Constraint Base Class.

METHODS

$self->default_message

Default error message for failing constraints.

$self->init($widget)

Called once when process() gets called for the first time.

$self->javascript($id)

Should return JavaScript for client side validation and the like.

$self->msg($message)

$self->message($message)

Contains the validation error message.

$self->mk_message

Returns a validation error message.

$self->names(@names)

Contains names of params to test.

$self->not($not)

Negate constraint.

$self->prepare($widget)

Called every time process() gets called.

$self->process( $widget, $params )

Validates params and returns a arrayref containing HTML::Widget::Error objects representing failed constraints.

$self->process_js($id)

Returns a hashref containing JavaScripts for client side validation and the like.

$self->validate($value)

Validates a value and returns 1 or 0.

AUTHOR

Sebastian Riedel, sri@oook.de

LICENSE

This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.