Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I was looking if it's possible to re-use the Sharepoint validation control used to check the URL name for special characters. I like to use this error validation in my custom application page to create new sites.

I'm looking for the ValidationExpression in fact...

Thanks in advance!

PS. Karine Bosh has written some nice post about validation controls: http://karinebosch.wordpress.com/sharepoint-controls/sharepoint-validation-controls/

share|improve this question
add comment

1 Answer

If you look at newsbweb.aspx you'll see that the validation is done in the form submit event rather than by a control

var ix = IndexOfIllegalCharInUrlLeafName(stname);
if (ix == -1)
    ix = stname.indexOf("+");
if(ix != -1)
{
    var ch = stname.charAt(ix);
    alert(StBuildParam(L_ContainIllegalChar_Text, L_webfield_TEXT, ch));
    return false;
}

The IndexOfIllegalCharInUrlLeafName function is contained in commonvalidation.js which also contains other url utility functions such as UrlContainsIllegalStrings

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.