Webylon 3.1 API Docs
  • Package
  • Class
  • Tree
  • Deprecated
  • Download
Version: current
  • 3.2
  • 3.1

Packages

  • auth
  • Booking
  • cart
    • shipping
    • steppedcheckout
  • Catalog
  • cms
    • assets
    • batchaction
    • batchactions
    • bulkloading
    • comments
    • content
    • core
    • export
    • newsletter
    • publishers
    • reports
    • security
    • tasks
  • Dashboard
  • DataObjectManager
  • event
  • faq
  • forms
    • actions
    • core
    • fields-basic
    • fields-dataless
    • fields-datetime
    • fields-files
    • fields-formatted
    • fields-formattedinput
    • fields-relational
    • fields-structural
    • transformations
    • validators
  • googlesitemaps
  • guestbook
  • installer
  • newsletter
  • None
  • photo
    • gallery
  • PHP
  • polls
  • recaptcha
  • sapphire
    • api
    • bulkloading
    • control
    • core
    • cron
    • dev
    • email
    • fields-formattedinput
    • filesystem
    • formatters
    • forms
    • i18n
    • integration
    • misc
    • model
    • parsers
    • search
    • security
    • tasks
    • testing
    • tools
    • validation
    • view
    • widgets
  • seo
    • open
      • graph
  • sfDateTimePlugin
  • spamprotection
  • stealth
    • captha
  • subsites
  • userform
    • pagetypes
  • userforms
  • webylon
  • widgets

Classes

  • DateField
  • DateField_Disabled
  • DatePickerField
  • DatetimeField_Readonly
  • TimeField
  • TimeField_Readonly

Class DateField

Form field to display an editable date string, either in a single <input type="text"> field, or in three separate fields for day, month and year.

# Configuration

  • 'showcalendar' (boolean): Determines if a calendar picker is shown. By default, "DHTML Calendar" is used,see http://www.dynarch.com/projects/calendar. CAUTION: Only works in NZ date format, see calendar-setup.js
  • 'dmyfields' (boolean): Show three input fields for day, month and year separately. CAUTION: Might not be useable in combination with 'showcalendar', depending on the used javascript library
  • 'dateformat' (string): Date format compatible with Zend_Date. Usually set to default format for DateField::$locale through Zend_Locale_Format::getDateFormat().
  • 'datavalueformat' (string): Internal ISO format string used by DateField::dataValue() to save the date to a database.
  • 'min' (string): Minimum allowed date value (in ISO format, or strtotime() compatible). Example: '2010-03-31', or '-7 days'
  • 'max' (string): Maximum allowed date value (in ISO format, or strtotime() compatible). Example: '2010-03-31', or '1 year'

# Localization

The field will get its default locale from i18n::get_locale(), and set the dateformat configuration accordingly. Changing the locale through DateField::setLocale() will not update the dateformat configuration automatically.

# Usage

Example: German dates with separate fields for day, month, year

$f = new DateField('MyDate'); $f->setLocale('de_DE'); $f->setConfig('dmyfields');

# Validation

Caution: JavaScript validation is only supported for the 'en_NZ' locale at the moment, it will be disabled automatically for all other locales.

Object
Extended by ViewableData implements IteratorAggregate
Extended by RequestHandler
Extended by FormField
Extended by TextField
Extended by DateField

Direct known subclasses

DateField_Disabled, DatePickerField

Package: forms\fields-datetime
Located at sapphire/forms/DateField.php

Methods summary

public
# __construct( FormField::$name $name, FormField::$title $title = null, FormField::$value $value = null, FormField::$form $form = null, TextField::$maxLength $rightTitle = null )

Returns an input field, class="text" and type="text" with an optional maxlength

Returns an input field, class="text" and type="text" with an optional maxlength

Parameters

$name
name The internal field name, passed to forms.
$title
title The field label.
$value
value The value of the field.
$form
form Reference to the container form
$rightTitle
maxLength The Maximum length of the attribute

Overrides

TextField::__construct
public
# setMin( mixed $value )
public
# setMax( mixed $value )
public
# ShowCalendar( )
public
# FieldHolder( )

Returns a "Field Holder" for this field - used by templates. Forms are constructed from by concatenating a number of these field holders. The default field holder is a label and form field inside a paragraph tag.

Returns a "Field Holder" for this field - used by templates. Forms are constructed from by concatenating a number of these field holders. The default field holder is a label and form field inside a paragraph tag.

Composite fields can override FieldHolder to create whatever visual effects you like. It's a good idea to put the actual HTML for field holders into templates. The default field holder is the DefaultFieldHolder template. This lets you override the HTML for specific sites, if it's necessary.

Overrides

FormField::FieldHolder
public
# Field( )

Returns the form field - used by templates. Although FieldHolder is generally what is inserted into templates, all of the field holder templates make use of $Field. It's expected that FieldHolder will give you the "complete" representation of the field on the form, whereas Field will give you the core editing widget, such as an input tag.

Returns the form field - used by templates. Although FieldHolder is generally what is inserted into templates, all of the field holder templates make use of $Field. It's expected that FieldHolder will give you the "complete" representation of the field on the form, whereas Field will give you the core editing widget, such as an input tag.

Our base FormField class just returns a span containing the value. This should be overridden!

Overrides

TextField::Field
protected mixed
# FieldDriver( String $html )

Caution: API might change. This will evolve into a pluggable API for 'form field drivers' which can add their own markup and requirements.

Caution: API might change. This will evolve into a pluggable API for 'form field drivers' which can add their own markup and requirements.

Parameters

$html
String $html

Returns

mixed
$html
public
# setValue( String|Array $val )

Sets the internal value to ISO date format.

Sets the internal value to ISO date format.

Parameters

$val
String|Array $val

Overrides

FormField::setValue
public String
# dataValue( )

Returns

String
ISO 8601 date, suitable for insertion into database

Overrides

FormField::dataValue
public
# performReadonlyTransformation( )

Returns a readonly version of this field

Returns a readonly version of this field

Overrides

FormField::performReadonlyTransformation
public
# jsValidation( )

javascript handler Functions for each field type by default formfield doesnt have a validation function

javascript handler Functions for each field type by default formfield doesnt have a validation function

Overrides

FormField::jsValidation
public boolean
# validateArrayValue( Array $val )

Validate an array with expected keys 'day', 'month' and 'year. Used because Zend_Date::isDate() doesn't provide this.

Validate an array with expected keys 'day', 'month' and 'year. Used because Zend_Date::isDate() doesn't provide this.

Parameters

$val
Array $val

Returns

boolean
boolean
public Boolean
# validate( mixed $validator )

Returns

Boolean
Boolean

Overrides

FormField::validate
public string
# getLocale( )

Returns

string
string
public
# setLocale( String $locale )

Caution: Will not update the 'dateformat' config value.

Caution: Will not update the 'dateformat' config value.

Parameters

$locale
String $locale
public
# setConfig( string $name, mixed $val )

Parameters

$name
string $name
$val
mixed $val
public mixed
# getConfig( String $name )

Parameters

$name
String $name

Returns

mixed
mixed

Methods inherited from TextField

InternallyLabelledField(), getMaxLength(), setMaxLength()

Methods inherited from FormField

LeftTitle(), Link(), Message(), MessageType(), Name(), Required(), RightTitle(), SmallFieldHolder(), Title(), Type(), Value(), addExtraAttribute(), addExtraClass(), allowHTML5(), allow_html5(), attrName(), attrTitle(), attrValue(), createTag(), debug(), describe(), extraClass(), forTemplate(), getCustomValidationMessage(), getForm(), getTabIndex(), getTabIndexHTML(), hasClass(), hasData(), id(), isComposite(), isDisabled(), isReadonly(), name_to_label(), performDisabledTransformation(), removeExtraAttribute(), removeExtraClass(), rootFieldSet(), saveInto(), securityTokenEnabled(), setAutocomplete(), setContainerFieldSet(), setCustomValidationMessage(), setDisabled(), setError(), setForm(), setHTML5Attribute(), setLeftTitle(), setName(), setReadonly(), setRightTitle(), setTabIndex(), setTitle(), transform(), useHTML5(), use_html5()

Methods inherited from RequestHandler

allowedActions(), checkAccessAction(), getRequest(), handleRequest(), hasAction(), httpError()

Methods inherited from ViewableData

ATT_val(), BaseHref(), CSSClasses(), ColumnBreak(), ColumnCalc(), ColumnNumber(), ColumnPad(), ColumnPos(), CurrentMember(), CurrentPage(), Debug(), Even(), EvenOdd(), First(), FirstLast(), HasPerm(), IsAjax(), JS_val(), Last(), Me(), Middle(), MiddleString(), Modulus(), MultipleOf(), Odd(), Pos(), RAW_val(), SQL_val(), ThemeDir(), ThemeName(), Top(), TotalItems(), XML_val(), __get(), __isset(), __set(), buildCastingCache(), cachedCall(), castingClass(), castingHelper(), castingHelperPair(), castingObjectCreator(), castingObjectCreatorPair(), customise(), defineMethods(), escapeTypeForField(), getField(), getIterator(), getSecurityID(), getXMLValues(), hasField(), hasValue(), i18nLocale(), iteratorProperties(), obj(), renderWith(), setCustomisedObj(), setField()

Methods inherited from Object

__call(), __toString(), __wakeup(), addMethodsFrom(), addStaticVars(), addWrapperMethod(), add_extension(), add_static_var(), allMethodNames(), cacheToFile(), cacheToFileWithArgs(), clearCache(), combined_static(), create(), createMethod(), create_from_string(), exists(), extInstance(), extend(), getCustomClass(), getExtensionInstance(), getExtensionInstances(), get_extensions(), get_static(), hasExtension(), hasMethod(), has_extension(), invokeWithExtensions(), is_a(), loadCache(), parentClass(), parse_class_spec(), remove_extension(), sanitiseCachename(), saveCache(), set_stat(), set_static(), set_uninherited(), stat(), strong_create(), uninherited(), uninherited_static(), useCustomClass()

Magic methods summary

Properties summary

protected array $config
#
protected String $locale
#
protected Zend_Date $valueObj
#

Just set if the date is valid. FormField::$value will always be set to aid validation, and might contain invalid values.

Just set if the date is valid. FormField::$value will always be set to aid validation, and might contain invalid values.

Properties inherited from TextField

$maxLength

Properties inherited from FormField

$autocomplete, $containerFieldSet, $customValidationMessage, $description, $disabled, $dontEscape, $extraAttributes, $extraClass, $extraClasses, $fieldHTML5, $form, $html5Attributes, $leftTitle, $message, $messageType, $name, $possible_autocomplete_values, $readonly, $rightTitle, $tabIndex, $title, $use_html5, $value

Properties inherited from RequestHandler

$allowed_actions, $brokenOnConstruct, $request, $url_handlers

Properties inherited from ViewableData

$casting, $customisedObject, $default_cast, $failover, $iteratorPos, $iteratorTotalItems

Properties inherited from Object

$class, $extension_instances, $extensions

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -
Webylon 3.1 API Docs API documentation generated by ApiGen 2.8.0