Skip to content

Instantly share code, notes, and snippets.

@phillipharding
Created September 1, 2014 11:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phillipharding/3d6dfc4cef9641c8bfbd to your computer and use it in GitHub Desktop.
Save phillipharding/3d6dfc4cef9641c8bfbd to your computer and use it in GitHub Desktop.
Link To Document Validate - New
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 no more than 128 characters for the document name.\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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment