diff --git a/core/model/SiteTree.php b/core/model/SiteTree.php index 4729d8ddb..6459b9c12 100644 --- a/core/model/SiteTree.php +++ b/core/model/SiteTree.php @@ -991,7 +991,10 @@ class SiteTree extends DataObject { "[^A-Za-z0-9-]+", "-", "URLs can only be made up of letters, digits and hyphens.", - "" + "", + "", + "", + 50 ), new LabelField("/") ), diff --git a/forms/UniqueTextField.php b/forms/UniqueTextField.php index f2146bde7..53d2049ad 100755 --- a/forms/UniqueTextField.php +++ b/forms/UniqueTextField.php @@ -50,10 +50,12 @@ class UniqueTextField extends TextField { } */ + $fieldSize = $this->maxLength ? min( $this->maxLength, 30 ) : 30; + if($this->maxLength){ - return /*implode("", $restrictedInputs).*/"class."\" type=\"text\" id=\"" . $this->id() . "\" name=\"{$this->name}\" value=\"" . $this->attrValue() . "\" maxlength=\"$this->maxLength\" />id()."]\" id=\"".$this->id()."-restricted-message\" value=\"{$this->restrictedMessage}\" />"; + return /*implode("", $restrictedInputs).*/"class."\" type=\"text\" id=\"" . $this->id() . "\" name=\"{$this->name}\" value=\"" . $this->attrValue() . "\" maxlength=\"$this->maxLength\" size=\"$fieldSize\" />id()."]\" id=\"".$this->id()."-restricted-message\" value=\"{$this->restrictedMessage}\" />"; }else{ - return /*implode("", $restrictedInputs).*/"class."\" type=\"text\" id=\"" . $this->id() . "\" name=\"{$this->name}\" value=\"" . $this->attrValue() . "\" />id()."]\" id=\"".$this->id()."-restricted-message\" value=\"{$this->restrictedMessage}\" />"; + return /*implode("", $restrictedInputs).*/"class."\" type=\"text\" id=\"" . $this->id() . "\" name=\"{$this->name}\" value=\"" . $this->attrValue() . "\" size=\"30\" />id()."]\" id=\"".$this->id()."-restricted-message\" value=\"{$this->restrictedMessage}\" />"; } } }