mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
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:
@@ -52,6 +52,7 @@ import org.alfresco.web.bean.repository.DataDictionary;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
import org.alfresco.web.ui.common.ComponentConstants;
|
||||
import org.alfresco.web.ui.repo.RepoConstants;
|
||||
import org.alfresco.web.ui.repo.component.UIMultiValueEditor;
|
||||
import org.alfresco.web.ui.repo.component.property.BaseAssociationEditor;
|
||||
import org.alfresco.web.ui.repo.component.property.PropertySheetItem;
|
||||
import org.alfresco.web.ui.repo.component.property.UIProperty;
|
||||
@@ -526,7 +527,9 @@ public abstract class BaseComponentGenerator implements IComponentGenerator
|
||||
|
||||
// add the value parameter
|
||||
String value = "document.getElementById('" +
|
||||
component.getClientId(context) + "')";
|
||||
component.getClientId(context) +
|
||||
(component instanceof UIMultiValueEditor ? "_current_value" : "") +
|
||||
"')";
|
||||
params.add(value);
|
||||
|
||||
// add the regular expression parameter
|
||||
@@ -554,7 +557,7 @@ public abstract class BaseComponentGenerator implements IComponentGenerator
|
||||
MessageFormat.format(noMatchMsg, new Object[] {property.getResolvedDisplayLabel()}));
|
||||
|
||||
// add the validation case to the property sheet
|
||||
propertySheet.addClientValidation(new ClientValidation("validateRegex",
|
||||
propertySheet.addClientValidation(new ClientValidation((component instanceof UIMultiValueEditor ? "validateMultivalueRegex" : "validateRegex"),
|
||||
params, realTimeChecking));
|
||||
}
|
||||
|
||||
|
@@ -55,7 +55,7 @@ public class MultiValueFieldRenderer extends BaseMultiValueRenderer
|
||||
protected void renderPostWrappedComponent(FacesContext context, ResponseWriter out,
|
||||
UIMultiValueEditor editor) throws IOException
|
||||
{
|
||||
out.write(" <input type='submit' value='");
|
||||
out.write(" <input type='button' value='");
|
||||
out.write(Application.getMessage(context, MSG_ADD_TO_LIST_BUTTON));
|
||||
out.write("' onclick=\"");
|
||||
out.write(generateFormSubmit(context, editor, Integer.toString(UIMultiValueEditor.ACTION_ADD)));
|
||||
|
@@ -12,7 +12,7 @@ function informUser(control, message, showMessage)
|
||||
if (showMessage)
|
||||
{
|
||||
alert(message);
|
||||
control.focus();
|
||||
if (control.type != "hidden") control.focus();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,6 +88,38 @@ function validateStringLength(control, min, max, message, showMessage)
|
||||
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 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.
|
||||
|
Reference in New Issue
Block a user