Merged DEV-TEMPORARY to HEAD

17092: ETHREEOH-2808: Regexp validation fails on IE and multiple value property.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@17111 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2009-10-23 09:43:24 +00:00
parent b99c60a115
commit ee18156073
3 changed files with 39 additions and 4 deletions

View File

@@ -12,7 +12,7 @@ function informUser(control, message, showMessage)
if (showMessage)
{
alert(message);
control.focus();
if (control.type != "hidden") control.focus();
}
}
@@ -94,6 +94,38 @@ function validateStringLength(control, min, max, message, showMessage)
*
* @return true if the regex validation passed
*/
function validateMultivalueRegex(control, expression, requiresMatch, matchMessage, noMatchMessage, showMessage)
{
var result = true;
var pattern = new RegExp(decode(expression));
var arrayOfStrings = control.value.substring(1, control.value.length - 1).split(", ");
for (var i=0; i < arrayOfStrings.length; i++)
{
var matches = pattern.test(arrayOfStrings[i]);
if (matches != requiresMatch)
{
if (requiresMatch)
{
informUser(control, noMatchMessage, showMessage);
return false;
}
else
{
informUser(control, matchMessage, showMessage);
return false;
}
}
}
return result;
}
/**
* Ensures the value of the 'control' matches the 'expression' if 'requiresMatch' is true.
* Ensures the value of the 'control' does not match the 'expression' if 'requiresMatch' is false.
*
* @return true if the regex validation passed
*/
function validateRegex(control, expression, requiresMatch, matchMessage, noMatchMessage, showMessage)
{
var result = true;