diff --git a/forms/RestrictedTextField.php b/forms/RestrictedTextField.php new file mode 100755 index 000000000..8516cb930 --- /dev/null +++ b/forms/RestrictedTextField.php @@ -0,0 +1,30 @@ +restrictedChars = $restrictedChars; + parent::__construct($name, $title, $value); + } + + function Field() { + Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang'); + Requirements::javascript( SAPPHIRE_DIR . '/javascript/UniqueFields.js' ); + + if($this->maxLength){ + $field = "id() . "\" name=\"{$this->name}\" value=\"" . $this->attrValue() . "\" maxlength=\"$this->maxLength\" />"; + }else{ + $field = "id() . "\" name=\"{$this->name}\" value=\"" . $this->attrValue() . "\" />"; + } + + return $field."id()."]\" id=\"".$this->id()."-restricted-chars\" value=\"".$this->restrictedChars."\" />"; + } +} +?> \ No newline at end of file diff --git a/forms/UniqueRestrictedTextField.php b/forms/UniqueRestrictedTextField.php new file mode 100755 index 000000000..e294ba5fc --- /dev/null +++ b/forms/UniqueRestrictedTextField.php @@ -0,0 +1,27 @@ +charRegex = $charRegex; + $this->charReplacement = $charReplacement; + $this->charMessage = $charMessage; + + parent::__construct($name, $restrictedField, $restrictedTable, $restrictedMessage, $title, $value, $maxLength); + } + + function Field() { + return parent::Field()."id()."]\" id=\"".$this->id()."-restricted-chars\" value=\"".$this->charRegex."\" />id()."]\" id=\"".$this->id()."-restricted-chars-replace\" value=\"".$this->charReplacement."\" />id()."]\" id=\"".$this->id()."-restricted-chars-message\" value=\"".$this->charMessage."\" />"; + } +} +?> \ No newline at end of file