|
NAMERose::HTML::Form::Field::DateTime::Range - Compound field for date ranges with separate text fields for the minimum and maximum dates.SYNOPSIS$field = Rose::HTML::Form::Field::DateTime::Range->new( label => 'Date', name => 'date', default => [ '1/2/2003', '4/5/2006' ]); my($min, $max) = $field->internal_value; # DateTime objects print $min->strftime('%Y-%m-%d'); # "2003-01-02" print $max->strftime('%Y-%m-%d'); # "2006-04-05" $field->input_value('5/6/1980 3pm to 2003-01-06 20:19:55'); my $dates = $field->internal_value; print $dates->[0]->hour; # 15 print $dates->[1]->hour; # 20 print $dates->[0]->day_name; # Tuesday print $field->html; ... DESCRIPTIONRose::HTML::Form::Field::DateTime::Range is a compound field that represents a date range. It is made up of two subfields: a Rose::HTML::Form::Field::DateTime::StartDate field and a Rose::HTML::Form::Field::DateTime::EndDate field.The internal value of this field is a list (in list context) or reference to an array (in scalar context) of two DateTime objects. The first object is the start date and the second is the end date. If either of fields are not filled in or are otherwise invalid, then the internal value is undef. The input value can be a reference to an array of DateTime objects, or strings that can be inflated into DateTime objects by the Rose::HTML::Form::Field::DateTime::StartDate and Rose::HTML::Form::Field::DateTime::EndDate classes. The input value can also be a concatenation of two such strings, joined by a string that matches the field's range_separator_regex. This class is a good example of a compound field whose internal value consists of more than one object. See below for more compound field examples. It is important that this class inherits from Rose::HTML::Form::Field::Compound. See the Rose::HTML::Form::Field::Compound documentation for more information. OBJECT METHODS
SEE ALSOOther examples of custom fields:
AUTHORJohn C. Siracusa (siracusa@gmail.com)LICENSECopyright (c) 2010 by John C. Siracusa. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Visit the GSP FreeBSD Man Page Interface. |