Docs For Class FEDate

## Class FEDate

Description

This class builds a widget that shows a group of select boxes (FEYears, FEMonths, FEDays) representing a date.

FEDate will display three drop down lists representing a date. You can set the order in which these elements are displayed and the minimum and maximum years displayed.

Like in FEMonths you should use the built in php setlocale function to affect the language used for the month list.

Example as it would appear in FormContent::form_init_elements():

          // set the locale to dutch
          setlocale(LC_TIME, 'nl_NL');
          $date_element = new FEDate("FEDate label", false, null, null, 'Fdy', 1970, 1975);

the $format parameter conforms the the php date function format argument specification (for years, months and days only).

- see: FEYears
- copyright: LGPL - See LICENCE
- see: FEDays
- see: FEMonths
- author: Culley Harrelson <culley@fastmail.fm>
- author: Suren Markosian <suren@emicron.net>

Located in /form/form_elements/FEListBox.inc (line 1227)

    FormElement
       |
       --FEBoxElement
          |
          --FEDate

Method Summary
FEDate FEDate (string $label, [boolean $required = TRUE], [int $width = NULL], [int $height = NULL], [string $format = 'mdy'], [int $min_year = 2000], [int $max_year = 2010])
container get_confirm_element ()
object get_element ()
array get_value ()
string get_value_text ()
void set_disabled (bool $flag)
void set_form_name (mixed $name)
void set_text_format (string $format)
void set_value (string $value)
boolean validate (FormValidation &$_FormValidation)
Variables

#### Inherited Variables

Inherited from FEBoxElement

> FEBoxElement::$_height
> FEBoxElement::$_width

Inherited from FormElement

> FormElement::$onBlurJS
> FormElement::$onChangeJS
> FormElement::$onClickJS
> FormElement::$onFocusJS
> FormElement::$onSubmitJS
> FormElement::$_attributes
> FormElement::$_element_name
> FormElement::$_errors
> FormElement::$_error_message
> FormElement::$_form_name
> FormElement::$_has_error
> FormElement::$_has_form_on_submit
> FormElement::$_is_disabled
> FormElement::$_is_readonly
> FormElement::$_is_required
> FormElement::$_label_colon_flag
> FormElement::$_label_text
> FormElement::$_required_field_marker
> FormElement::$_slave_elements
> FormElement::$_stripslashes
> FormElement::$_style_attributes
> FormElement::$_validation_enabled
> FormElement::$_value

Methods
Constructor FEDate (line 1302)

The constructor

- access: public
- todo: we need to blow up somehow if the format string is bogus
- see: FEDate for an example

FEDate FEDate (string $label, [boolean $required = TRUE], [int $width = NULL], [int $height = NULL], [string $format = 'mdy'], [int $min_year = 2000], [int $max_year = 2010])

- string $label: text label for the element
- boolean $required: is this a required element?
- int $width: element width in characters, pixels (px), percentage (%) or elements (em)
- int $height: element height in px
- string $format: date format string. M m F Y y d D are valid. 3 characters max.
- int $min_year: min value for year drop down list
- int $max_year: max value for year drop down list

get_confirm_element (line 1540)

This method returns the hidden version of this element for a confirmation page.

NOTE: This is called by the FormProcessor only. It shouldn't be called manually.

- access: public

container get_confirm_element ()

Redefinition of:

FormElement::get_confirm_element()
  This method returns the hidden version of this element for a confirmation page.

get_element (line 1339)

This function builds and returns the form element object

- access: public

object get_element ()

Redefinition of:

FormElement::get_element()
  This function builds and returns the form element object. This method ignores the readonly flag.

get_value (line 1369)

This function will return the elements value as an array or month, day and year

- access: public

array get_value ()

Redefinition of:

FormElement::get_value()
  This function will return the elements value

get_value_text (line 1412)

This returns a formatted string used for the confirmation display (and possibly elsewhere)

- access: public

string get_value_text ()

Redefinition of:

FormElement::get_value_text()
  This provides a method

set_disabled (line 1556)

Sets the disabled element flag

void set_disabled (bool $flag)

- bool $flag: disabled

Redefinition of:

FormElement::set_disabled()
  Sets the disabled element flag

set_form_name (line 1325)

We need to override this so we get the form name set in the child elements so the id attributes are set correctly.

void set_form_name (mixed $name)

Redefinition of:

FormElement::set_form_name()
  in case anyone in JS land needs the name of the form that this element lives in

set_text_format (line 1526)

Set the text format for confirmation

this method sets the format string used in get_value_text(). Use this method to set special punctuation for the confirmation display. It is fed through sprintf

Examples:

      $date_element->set_text_format("%s %s, %s");
      $date_element->set_text_format("%04d-%02d-%02d");

- link: http://www.php.net/manual/en/function.sprintf.php
- access: public

void set_text_format (string $format)

- string $format

set_value (line 1389)

Set the value of the element

This function sets the default values for the date element The parameter should be a string representation of the date in ISO 8601 format.

- access: public

void set_value (string $value)

- string $value

Redefinition of:

FormElement::set_value()
  This function will set the initial value for the element

validate (line 1461)

This function is responsible for performing complete validation and setting the appropriate error message in case of a failed validation

- return: success or failure
- access: public

boolean validate (FormValidation &$_FormValidation)

- FormValidation &$_FormValidation

Redefinition of:

FormElement::validate()
  This function performs the actual validation It is called only if the validation is required by this element

#### Inherited Methods

Inherited From FEBoxElement

> FEBoxElement::FEBoxElement()

Inherited From FormElement

> FormElement::FormElement()
> FormElement::build_id_name()
> FormElement::create_element_name()
> FormElement::enable_validation()
> FormElement::form_tag_onsubmit()
> FormElement::get_attribute()
> FormElement::get_confirm_element()
> FormElement::get_element()
> FormElement::get_element_name()
> FormElement::get_errors()
> FormElement::get_error_message()
> FormElement::get_form_element()
> FormElement::get_init_value()
> FormElement::get_label()
> FormElement::get_label_text()
> FormElement::get_required_symbol()
> FormElement::get_slave_elements()
> FormElement::get_tabindex()
> FormElement::get_value()
> FormElement::get_value_text()
> FormElement::has_error()
> FormElement::is_disabled()
> FormElement::is_readonly()
> FormElement::is_required()
> FormElement::javascript()
> FormElement::onBlur()
> FormElement::onChange()
> FormElement::onClick()
> FormElement::onFocus()
> FormElement::onSubmit()
> FormElement::set_attribute()
> FormElement::set_colon_flag()
> FormElement::set_data_all_slaves()
> FormElement::set_disabled()
> FormElement::set_element_name()
> FormElement::set_error_message()
> FormElement::set_form_name()
> FormElement::set_label_text()
> FormElement::set_onBlur()
> FormElement::set_onChange()
> FormElement::set_onClick()
> FormElement::set_onFocus()
> FormElement::set_onSubmit()
> FormElement::set_readonly()
> FormElement::set_required()
> FormElement::set_required_symbol()
> FormElement::set_slave_data()
> FormElement::set_slave_elements()
> FormElement::set_stripslashes()
> FormElement::set_style_attribute()
> FormElement::set_tabindex()
> FormElement::set_title()
> FormElement::set_value()
> FormElement::validate()
> FormElement::_build_element_attributes()
> FormElement::_build_javascript()
> FormElement::_do_validation()
> FormElement::_sanitize_string()

Documentation generated on Thu, 1 Sep 2005 17:05:43 -0700 by phpDocumentor 1.3.0RC3