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

  • EditableCheckbox
  • EditableCheckboxGroupField
  • EditableCountryDropdownField
  • EditableDateField
  • EditableDropdown
  • EditableEmailField
  • EditableFileField
  • EditableFormField
  • EditableFormHeading
  • EditableHiddenField
  • EditableLiteralField
  • EditableMemberListField
  • EditableMultipleOptionField
  • EditableOption
  • EditableRadioField
  • EditableSiteAgreementField
  • EditableTextField
  • FieldEditor
  • SubmittedFileField
  • SubmittedForm
  • SubmittedFormField
  • SubmittedFormReportField
  • UserDefinedForm
  • UserDefinedForm_EmailRecipient
  • UserDefinedForm_SubmittedFormEmail
  • UserFormsVersionedTask
 1 <?php
 2 /**
 3  * EditableTextField
 4  *
 5  * This control represents a user-defined text field in a user defined form
 6  *
 7  * @package userforms
 8  */
 9 
10 class EditableTextField extends EditableFormField {
11 
12     static $singular_name = 'Text Field';
13     
14     static $plural_name = 'Text Fields';
15     
16     function getFieldConfiguration() {
17         $fields = parent::getFieldConfiguration();
18         
19         $min = ($this->getSetting('MinLength')) ? $this->getSetting('MinLength') : '';
20         $max = ($this->getSetting('MaxLength')) ? $this->getSetting('MaxLength') : '';
21         
22         $rows = ($this->getSetting('Rows')) ? $this->getSetting('Rows') : '1';
23         
24         $extraFields = new FieldSet(
25             new FieldGroup(_t('EditableTextField.TEXTLENGTH', 'Text length'),
26                 new TextField($this->getSettingName('MinLength'), "", $min),
27                 new TextField($this->getSettingName('MaxLength'), " - ", $max)
28             ),
29             new TextField($this->getSettingName('Rows'), _t('EditableTextField.NUMBERROWS', 'Number of rows'), $rows)
30         );
31         
32         $fields->merge($extraFields);
33         
34         return $fields;     
35     }
36 
37     /**
38      * @return TextareaField|TextField
39      */
40     function getFormField() {
41         if($this->getSetting('Rows') && $this->getSetting('Rows') > 1) {
42             return new TextareaField($this->Name, $this->Title, $this->getSetting('Rows'));
43         }
44         else {
45             return new TextField($this->Name, $this->Title, null, $this->getSetting('MaxLength'));
46         }
47     }
48     
49     /**
50      * Return the validation information related to this field. This is 
51      * interrupted as a JSON object for validate plugin and used in the 
52      * PHP. 
53      *
54      * @see http://docs.jquery.com/Plugins/Validation/Methods
55      * @return array
56      */
57     public function getValidation() {
58         $options = parent::getValidation();
59         
60         if($this->getSetting('MinLength')) 
61             $options['minlength'] = $this->getSetting('MinLength');
62             
63         if($this->getSetting('MaxLength')) 
64             $options['maxlength'] = $this->getSetting('MaxLength');
65         
66         return $options;
67     }
68 }
[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