Fixup NewLink.aspx Page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (window) { | |
// are we on the NewLink.aspx page | |
if (!window.location.href.match(/_layouts\/NewLink.aspx\?/gi)) return; | |
/* is it for adding an item of a content type | |
inheriting the 'Document Link' content type item? */ | |
var params=window.location.search.split('?')[1].split('&'); | |
var s=$rb.grep(params, function(e) { | |
var p = e.split('='); | |
return (p.length > 1) && p[0].match(/ContentTypeId/gi) && p[1].match(/^0x01010A/gi); | |
}); | |
if (!s || !s.length) return; | |
/* now rewrite SharePoint's ValidateInput(...) function */ | |
window.ValidateInput = function() | |
{ULSvlv:; | |
var L_ItemOrFolderNameTooLong_Ex = "The specified document name or URL is too long. The URL must be less than 255 characters and the document name must be less than 128 characters.\nPlease enter a shorter document name or URL."; | |
var L_EnterValidUrl_Text_Ex = "Enter a valid document name and URL. Valid URLs must begin with \u0027http:\u0027 or \u0027https:\u0027 and must be less than 255 characters."; | |
var form = document.forms.aspnetForm; | |
var folderUrl = form.ctl00_PlaceHolderMain_ctl01_ctl01_UrlInput.value; | |
var name = form.ctl00_PlaceHolderMain_ctl01_ctl01_NameInput.value; | |
if (name == null || | |
folderUrl == null || | |
typeof(name) == "undefined" || | |
typeof(folderUrl) == "undefined" || | |
name.length == 0 || | |
!HasValidUrlPrefix(folderUrl)) | |
{ | |
alert(L_EnterValidUrl_Text_Ex); | |
return false; | |
} | |
if ((name.length > 128) || | |
(folderUrl.length > 255)) | |
{ | |
alert(L_ItemOrFolderNameTooLong_Ex); | |
return false; | |
} | |
return true; | |
} | |
})(window); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment