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

Packages

  • 1c
    • exchange
      • catalog
  • auth
  • Booking
  • building
    • company
  • cart
    • shipping
    • steppedcheckout
  • Catalog
    • monument
  • 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

  • CheckboxField
  • CheckboxField_Disabled
  • CheckboxField_Readonly
  • CheckboxSetField
  • DropdownField
  • GroupedDropdownField
  • ListboxField
  • LookupField
  • Monument_PolishingTextField
  • NullableField
  • OptionsetField
  • ReadonlyField
  • RoomServiceDropdownField
  • SimpleHTMLEditorField
  • SimpleTinyMCEField
  • SimpleWysiwygField
  • SocleSize_SocleSectionTextField
  • StateDropdownField
  • StateProvinceDropdownField
  • TextareaField
  • TextField
 1 <?php
 2 /**
 3  * Text input field.
 4  * @package forms
 5  * @subpackage fields-basic
 6  */
 7 class TextField extends FormField {
 8 
 9     /**
10      * @var Int
11      */
12     protected $maxLength;
13     
14     /**
15      * Returns an input field, class="text" and type="text" with an optional maxlength
16      */
17     function __construct($name, $title = null, $value = "", $maxLength = null, $form = null){
18         $this->maxLength = $maxLength;
19         
20         parent::__construct($name, $title, $value, $form);
21     }
22     
23     /**
24      * @param Int $length
25      */
26     function setMaxLength($length) {
27         $this->maxLength = $length;
28     }
29     
30     /**
31      * @return Int
32      */
33     function getMaxLength() {
34         return $this->maxLength;
35     }
36     
37     function Field() {
38         $attributes = array(
39             'type' => 'text',
40             'class' => 'text ' . $this->class . ($this->extraClass() ? $this->extraClass() : ''),
41             'id' => $this->id(),
42             'name' => $this->Name(),
43             'value' => $this->Value(),
44             'tabindex' => $this->getTabIndex(),
45             'maxlength' => ($this->maxLength) ? $this->maxLength : null,
46             'size' => ($this->maxLength) ? min( $this->maxLength, 30 ) : null 
47         );
48         
49         if($this->disabled) $attributes['disabled'] = 'disabled';
50         
51         return $this->createTag('input', $attributes);
52     }
53     
54     function InternallyLabelledField() {
55         if(!$this->value) $this->value = $this->Title();
56         return $this->Field();
57     }
58     
59 }
60 ?>
[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.2 API Docs API documentation generated by ApiGen 2.8.0