Version: current

     1 <?php
     2 /**
     3  * Text field that automatically checks that the value entered is unique for the given
     4  * set of fields in a given set of tables
     5  * @deprecated 2.5
     6  * @package forms
     7  * @subpackage fields-formattedinput
     8  */
     9 class UniqueRestrictedTextField extends UniqueTextField {
    10
    11     protected $charRegex;
    12     protected $charReplacement;
    13     protected $charMessage;
    14
    15     function __construct($name, $restrictedField, $restrictedTable, $restrictedMessage, $charRegex, $charReplacement, $charMessage, $title = null, $value = "", $maxLength = null ){
    16         parent::__construct($name, $restrictedField, $restrictedTable, $restrictedMessage, $title, $value, $maxLength);
    17
    18         $this->charRegex = $charRegex;
    19         $this->charReplacement = $charReplacement;
    20         $this->charMessage = $charMessage;
    21     }
    22
    23     function Field() {
    24             return parent::Field()."<input type=\"hidden\" name=\"restricted-chars[".$this->id()."]\" id=\"".$this->id()."-restricted-chars\" value=\"".$this->charRegex."\" /><input type=\"hidden\" name=\"restricted-chars[".$this->id()."]\" id=\"".$this->id()."-restricted-chars-replace\" value=\"".$this->charReplacement."\" /><input type=\"hidden\" name=\"restricted-chars[".$this->id()."]\" id=\"".$this->id()."-restricted-chars-message\" value=\"".$this->charMessage."\" />";
    25     }
    26 }
    27 ?>

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