GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Form::Sensible::Field::DateTime(3) User Contributed Perl Documentation Form::Sensible::Field::DateTime(3)

Form::Sensible::Field::DateTime - A DateTime field type.

    use Form::Sensible::Field::DateTime;
    
    my $object = Form::Sensible::Field::DateTime->new(
                    span => datetime_span_object,
                    recurrence => $recurrence_sub,
    );

    $object->do_stuff();

    my $object2 = Form::Sensible::Field::DateTime->new(
                    span => datetime_span_object,
                    recurrence => 'hourly',
    );

    $object2->do_stuff();

The datetime field type is one of the more advanced field types in Form::Sensible. It uses DateTime::Format::Natural to format user input into a valid DateTime object, and uses DateTime::Set to allow date range numbers. It can be set to have a lower and upper bound, allowing validation to ensure that the value selected is within a range.

Finally, it can be rendered in a number of ways including select boxes, drop downs or even ranged-sliders if your renderer supports it. It can have a 'recurrence', which provides a constraint to what values are valid between the datetime span, otherwise it just returns the DateTime value set for the field.

"recurrence"
A subroutine that is used when this field is used as a Select field. See the "from_recurrence" method in DateTime::Set for more information on how you might structure the subroutine. Only useful when "span" is defined. As a convenience, if you pass the following strings, they will DWYM:
yearly
by_year
monthly
by_month
daily
by_day
"span"
A DateTime::Span object that is used to represent the valid date range for this field.

"validate"
Validates the field against the numeric constraints set for the field.
"get_additional_configuration"
Returns a hashref consisting of the attributes for this field and their values.

The following two methods allow DateTime fields to be treated like Select Fields for rendering purposes.

"get_options()"
An array ref containing the allowed options. Each option is represented as a hash containing a "name" element and a "value" element for the given option.
"set_selection()"
Sets whatever is the current "$self->value" option as the selected option selected. This is used when a "DateTime" field is used as a "Select" field and overrides Select's "set_selection" method.
"accepts_multiple"
On a Select field, this defines whether the field can have multiple values. For a DateTime field, only one value is allowed, so this always returns false.

David Romano - <unobe@cpan.org>

Ionzero LLC. <http://ionzero.com/>

Form::Sensible

Copyright (c) 2012 by Ionzero LLC

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

Hey! The above document had some coding errors, which are explained below:
Around line 225:
You forgot a '=back' before '=head1'
2012-02-02 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.