I am trying to calculate an end DateTime from an entered start DateTime and a duration (in minutes) using an custom inflator
         - type: Hidden
           name: duration
           value: 300
         - type: DateTime
           name: start_time
           label: 'Start Date / Time'
           auto_inflate: 1
           constraints:
              - type: Required
         - type: Hidden
           name: end_time
           inflator: '+MyCustomInflator::EndDate'

package MyCustomInflator::EndDate;

use strict;
use base 'HTML::FormFu::Inflator::DateTime';

sub new {
   my $self = shift->SUPER::new( @_ );
   return $self;
}

sub inflator {
   my ( $self, $value ) = @_;
   my $d = $self->form->input->{start_time_day};
   my $m = $self->form->input->{start_time_month};
my $y = $self->form->input->{start_time_year}; my $h = $self->form->input->{start_time_hour};
   my $min = $self->form->input->{start_time_minute};
   my $dur = $self->form->input->{duration};
   my $dt = $self->SUPER::inflator( "$d-$m-$y $h:$min" );
   return $dt->add( minutes => $dur );
}

When i submit the form  the validation  fails  for the  end_time element
$form->get_error( name => 'end_time' ) returns HTML::FormFu::Exception::Inflator

any ideas where i'm going wrong?

Thanks

--
MINDsweep
25 albany street
edinburgh - UK - eh1 3qn

m: 07786984428


MINDsweep www.mindsweep.net is a division of c2sky services limited
www.c2sky.net

This e-mail may contain confidential information.  It is intended solely
for the attention of the designated recipient(s).  If you are not the
intended recipient, you must not make any use of the information
contained in the e-mail or cause or allow anyone to do so.  Please
contact the sender immediately and delete the message.


_______________________________________________
HTML-FormFu mailing list
[email protected]
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu

Reply via email to