Version: current

     1 <?php
     2 /**
     3  * EditableEmailField
     4  *
     5  * Allow users to define a validating editable email field for a UserDefinedForm
     6  *
     7  * @package userforms
     8  */
     9
    10 class EditableEmailField extends EditableFormField {
    11
    12     static $singular_name = 'Email Field';
    13
    14     static $plural_name = 'Email Fields';
    15
    16     function getFormField() {
    17         return new EmailField($this->Name, $this->Title);
    18     }
    19
    20     /**
    21      * Return the validation information related to this field. This is
    22      * interrupted as a JSON object for validate plugin and used in the
    23      * PHP.
    24      *
    25      * @see http://docs.jquery.com/Plugins/Validation/Methods
    26      * @return Array
    27      */
    28     public function getValidation() {
    29
    30         return array_merge(
    31             parent::getValidation(),
    32             array(
    33                 'email' => true
    34             )
    35         );
    36     }
    37 }

[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. -