previousHTML_QuickForm_autocomplete::setoptions() (Previous) (Next) コンストラクタ HTML_QuickForm_date()next

View this page in Last updated: Sun, 21 Jun 2009
English | Brazilian Portuguese | Chinese | Dutch | French | German | Hungarian | Japanese | Polish | Russian | Spanish | Turkish

HTML_QuickForm_date クラス概要

HTML_QuickForm_date クラス概要 – 日付 (および時刻) の入力に使用する要素グループのためのクラス

Description

この要素は日付および時刻を入力するためのもので、基本的には <select> のグループです。

HTML_QuickForm_date のクラス階層

HTML_QuickForm_date が継承しているメソッド

HTML_QuickForm_group から継承したもの
メソッド名 概要
コンストラクタHTML_QuickForm_group::HTML_QuickForm_group() クラスのコンストラクタ
HTML_QuickForm_group::accept() レンダラを受け入れる
HTML_QuickForm_group::exportValue() 通常は、グループの値を取得するには個々の要素に対してアクセスする
HTML_QuickForm_group::getElementName() html フォーム中に見られる、グループ内の要素名を返す
HTML_QuickForm_group::getElements() グループ化された要素群を取得する
HTML_QuickForm_group::getFrozenHtml() HTML タグを含めずにフィールドの値を返す
HTML_QuickForm_group::getGroupType() グループ内の要素の型を取得する。複数の型の要素から構成されている場合は 'mixed' を返す
HTML_QuickForm_group::getName() グループ名を返す
HTML_QuickForm_group::getValue() グループの値を返す
HTML_QuickForm_group::onQuickFormEvent() この要素上でイベントが発生した場合に HTML_QuickForm からコールされる
HTML_QuickForm_group::setElements() グループ化された要素群を設定する
HTML_QuickForm_group::setName() グループ名を設定する
HTML_QuickForm_group::setValue() グループの要素の値を設定する

HTML_QuickForm_element から継承したもの
メソッド名 概要
コンストラクタ HTML_QuickForm_element::HTML_QuickForm_element() クラスのコンストラクタ
HTML_QuickForm_element::accept() レンダラを受け入れる
HTML_QuickForm_element::apiVersion() 現在の API のバージョンを返す
HTML_QuickForm_element::exportValue() '安全な' 要素の値を返す
HTML_QuickForm_element::freeze() 要素を凍結し、その値のみを返す
HTML_QuickForm_element::getFrozenHtml() HTML タグを含めずにフィールドの値を返す
HTML_QuickForm_element::getLabel() 要素の表示テキストを返す
HTML_QuickForm_element::getName() 要素名を返す
HTML_QuickForm_element::getType() 要素の型を返す
HTML_QuickForm_element::getValue() フォーム要素の値を返す
HTML_QuickForm_element::isFrozen() 要素が凍結されているかどうかを返す
HTML_QuickForm_element::onQuickFormEvent() この要素上でイベントが発生した場合に HTML_QuickForm からコールされる
HTML_QuickForm_element::setLabel() 要素の表示テキストを設定する
HTML_QuickForm_element::setName() 入力フィールドの名前を設定する
HTML_QuickForm_element::setPersistantFreeze() 要素の値を、それが凍結されているかどうかにかかわらず hidden フィールドに保持し続けるかどうかを設定する
HTML_QuickForm_element::setValue() フォーム要素の値を設定する
HTML_QuickForm_element::unfreeze() フォーム要素の凍結を解除する

previousHTML_QuickForm_autocomplete::setoptions() (Previous) (Next) コンストラクタ HTML_QuickForm_date()next

Download Documentation Last updated: Sun, 21 Jun 2009
Do you think that something on this page is wrong? Please file a bug report or add a note.
User Notes:
Note by: cweiske
Here is how to invalidate dates in the past:
<?php
$form
->addRule(
    
'datefieldname''Date is in the past',
    
'callback''classname::checkDateNotPast'
);


/**
 * Checks if the given date is in the past.
 *
 * @param array $arDate Key-value pair array with d, m and Y keys
 *
 * @return boolean True if all is ok, false if the date is in the past.
 */
public static function checkDateNotPast($arDate)
{
    
$nDate mktime(000$arDate['m'], $arDate['d'], $arDate['Y']);
    if (
$nDate time()) {
        return 
false;
    }
    return 
true;
}
//public static function checkDateNotPast()
?>
Note by: dwarth@gmail.com
As this element is a subclass of HTML_QuickForm_group you can't use the addRule() method with the "required" validation rule, you must use the addGroupRule() method.

example:

$options = array(
'language' => 'en',
'format' => 'Ymd',
'minYear' => 2007,
'maxYear' => date('Y') + 2,
'addEmptyOption' => true
);
$form->addElement('date', 'TheDate', 'Date', $options);

$form->addGroupRule('TheDate', 'enter a date', 'required');