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

  • AjaxUniqueTextField
  • AutocompleteTextField
  • ConfirmedPasswordField
  • CreditCardField
  • CurrencyField
  • CurrencyField_Disabled
  • CurrencyField_Readonly
  • EmailField
  • HtmlEditorConfig
  • HtmlEditorField
  • HtmlEditorField_Readonly
  • HtmlEditorField_Toolbar
  • NumericField
  • PasswordField
  • PhoneNumberField
  • UniqueRestrictedTextField
  • UniqueTextField
 1 <?php
 2 /**
 3  * Autocompleting text field, using script.aculo.us
 4  * @package forms
 5  * @subpackage fields-formattedinput
 6  */
 7 class AutocompleteTextField extends TextField {
 8     
 9     protected $optionsURL;
10     
11     function __construct($name, $title = null, $optionsURL, $value = "", $maxLength = null){
12         $this->optionsURL = $optionsURL;        
13     
14         parent::__construct($name, $title, $value, $maxLength);
15     }
16     
17     function extraClass() {
18         return parent::extraClass() . " autocomplete";
19     }
20     
21     function Field() {
22         // Requirements::javascript(SAPPHIRE_DIR . '/javascript/AutocompleteTextField.js');
23         $attributes = array(
24             'class' => "{$this->class} text" . ($this->extraClass() ? $this->extraClass() : ''),
25             'type' => 'text',
26             'id' => $this->id(),
27             'name' => $this->name,
28             'value' => $this->Value(),
29             'tabindex' => $this->getTabIndex(),
30             'size' => $this->maxLength ? min( $this->maxLength, 30 ) : 30 
31         );  
32         if($this->maxLength) $attributes['maxlength'] = $this->maxLength;
33 
34         return $this->createTag('input', $attributes) . "<div id=\"" . $this->id() . "_Options\" class=\"autocompleteoptions\"></div>";
35     }
36     
37     function FieldHolder() {
38         $holder = parent::FieldHolder();
39         
40         $id = $this->id();
41         
42         $holder .= <<<JS
43             <script type="text/javascript">
44                 new Ajax.Autocompleter( '$id', '{$id}_Options', '{$this->optionsURL}', { afterUpdateElement : function(el) { if(el.onajaxupdate) { el.onajaxupdate(); } } } );
45             </script>
46 JS;
47 
48         return $holder;
49     }
50 }
51 ?>
[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