FORMfields, the premiere web framework
Support Home | Knowledge Base | Documentation | Forums | Contact Us
FORMfields & FORMgen :: Field Customizations

Extending the Range of Years in a DateField

(2279 views. Last Updated: 2007-12-04 9:38 AM)

You can extend the date range back to 1970-01-01 in FORMgen, by editing the DateField, BritishDateField or DateTimeField and setting the Start Date to 1970-01-01.

Alternatively, you can extend the range of years further by manually editing your form and replacing:
$ffForm->addField(new DateField("date", "Date", FORM_FIELD_REQUIRED, " ", null, null));
with something like:
$ffForm->addField(new DateField("date", "Date", FORM_FIELD_REQUIRED, " ", null, null));
$ffForm->formFields["date"]->year->options = FfHelper::genArray("1940", "2016");
$ffForm->formFields["date"]->year->values = $ffForm->formFields["date"]->year->options;

(Note: dates earlier than 1970-01-01 cannot be used for startDate or endDate parameters as the PHP date functions don't support these dates).
Support | Earn Money
Copyright © 2005-2020 Brain Book Software LLC.
Built with FORMfields, the premiere web framework.