HTML::FormFu::Plugin::StashValid - place valid params on form stash


HTML-FormFu documentation Contained in the HTML-FormFu distribution.

Index


Code Index:

NAME

Top

HTML::FormFu::Plugin::StashValid - place valid params on form stash

SYNOPSIS

Top

    # called on a form or block
    ---
    plugins:
      - type: StashValid
        names: ['field-names']

    # called on a field
    ---
    elements:
      - name: foo
        plugins: 
          - StashValid

DESCRIPTION

Top

Run during the post_process in HTML::FormFu::Plugin hook (called during process in HTML::FormFu). If the named field(s) have a valid value after processing, that value is placed on the form stash, using the field-name as the stash-key.

METHODS

Top

Arrayref of field names, whose valid values should be stashed.

SEE ALSO

Top

Is a sub-class of, and inherits methods from HTML::FormFu::Plugin

HTML::FormFu

AUTHOR

Top

Carl Franks cfranks@cpan.org

LICENSE

Top

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


HTML-FormFu documentation Contained in the HTML-FormFu distribution.

package HTML::FormFu::Plugin::StashValid;

use Moose;
extends 'HTML::FormFu::Plugin';

sub post_process {
    my ($self) = @_;

    my $form = $self->form;
    my $name = $self->parent->nested_name;

    if ( $form->valid($name) ) {
        $form->stash->{$name} = $form->param($name);
    }

    return;
}

__PACKAGE__->meta->make_immutable;

1;

__END__