NAME

SyForm - Easy form management

VERSION

version 0.103

SYNOPSIS

use SyForm;

my $form = SyForm->new( fields => [
  'username' => {
    required => 1,
    label => 'Your name',
    html => 'text',
  },
  'age' => {
    decimal => 1,
    label => 'Your age',
    html => 'text',
  },
  'unchecked' => {
    label => 'Unchecked',
    html => 'textarea',
  },
]);

my $view = $form->process( username => 'YoCoolCopKiller', age => 13 );

# or ...
# $values = $form->process_values(%args);
# my $value = $values->value;
# !$values->can('success'); # values are only the input
# $results = $form->process_results(%args);
# my $result = $results->get_result('username');
# my $value = $results->values->get_value('username');
# my $success = $result->success # result is after check

for my $field_name (@{$view->field_names}) {
  my $input_value = $view->field($field_name)->value;
  if ($view->success) {
    my $verified_result = $view->field($field_name)->result;  
  } else {
    # result is filled for all valid fields, even on invalid form
    my $verified_result_if_exist = $view->field($field_name)->result;
  }
  # for access to the main SyForm::Field of the view field
  my $syform_field = $view->field($field_name)->field;
}

$view->html_render; # get HTML

DESCRIPTION

Deprecated Please do not use!

AUTHOR

Torsten Raudssus <torsten@raudss.us>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Torsten Raudssus.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.