package LIMS::Controller::Roles::FormData;

use Moose::Role;

use Data::FormValidator;

sub get_data_from_dfv {
    my $self = shift;
    my $profile = shift
        || return $self->error('no profile passed to get_data_from_dfv()');
    
    my $dfv = Data::FormValidator->check($self->query, $profile);
    my $data = $dfv->valid(); # $self->debug($data);
    
    return $data;
}

sub validate_form_params {
    my $self = shift;
    my $profile = shift
        || return $self->error('no profile passed to get_data_from_dfv()');

    my $results = Data::FormValidator->check($self->query, $profile);    
    return $results;
}

1;
