2007-07-19 12:40:28 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* A Text field that cannot contain certain characters
|
2008-10-16 15:44:20 +02:00
|
|
|
* @deprecated 2.3
|
2008-01-09 05:18:36 +01:00
|
|
|
* @package forms
|
|
|
|
* @subpackage fields-formatted
|
2007-07-19 12:40:28 +02:00
|
|
|
*/
|
|
|
|
class RestrictedTextField extends TextField {
|
|
|
|
|
|
|
|
protected $restrictedChars;
|
|
|
|
|
|
|
|
function __construct($name, $title = null, $value = "", $restrictedChars = "", $maxLength = null){
|
|
|
|
$this->restrictedChars = $restrictedChars;
|
2008-12-04 23:38:32 +01:00
|
|
|
parent::__construct($name, $title, $value);
|
2007-07-19 12:40:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function Field() {
|
ENHANCEMENT Introduced constants for system paths like /sapphire in preparation for a more flexible directory reorganisation. Instead of hardcoding your path, please use the following constants: BASE_PATH, BASE_URL, SAPPHIRE_DIR, SAPPHIRE_PATH, CMS_DIR, CMS_PATH, THIRDPARTY_DIR, THIRDPARTY_PATH, ASSETS_DIR, ASSETS_PATH, THEMES_DIR, THEMES_PATH
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@63154 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-09-27 18:02:38 +02:00
|
|
|
Requirements::javascript( SAPPHIRE_DIR . '/javascript/UniqueFields.js' );
|
2007-07-19 12:40:28 +02:00
|
|
|
|
|
|
|
if($this->maxLength){
|
|
|
|
$field = "<input class=\"text restricted\" type=\"text\" id=\"" . $this->id() . "\" name=\"{$this->name}\" value=\"" . $this->attrValue() . "\" maxlength=\"$this->maxLength\" />";
|
|
|
|
}else{
|
|
|
|
$field = "<input class=\"text restricted\" type=\"text\" id=\"" . $this->id() . "\" name=\"{$this->name}\" value=\"" . $this->attrValue() . "\" />";
|
|
|
|
}
|
|
|
|
|
|
|
|
return $field."<input type=\"hidden\" name=\"restricted-chars[".$this->id()."]\" id=\"".$this->id()."-restricted-chars\" value=\"".$this->restrictedChars."\" />";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|