You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "James Holmes (JIRA)" <ji...@apache.org> on 2008/06/30 15:19:05 UTC
[jira] Updated: (WW-2700) validateAnnotatedMethodOnly parameter in
validation interceptor did not take effect in Client validation
[ https://issues.apache.org/struts/browse/WW-2700?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
James Holmes updated WW-2700:
-----------------------------
Fix Version/s: 2.1.3
> validateAnnotatedMethodOnly parameter in validation interceptor did not take effect in Client validation
> --------------------------------------------------------------------------------------------------------
>
> Key: WW-2700
> URL: https://issues.apache.org/struts/browse/WW-2700
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: 2.0.11.1
> Environment: Eclipse 3.3, FireFox 3
> Reporter: eik lee
> Fix For: 2.1.3
>
>
> I used annotated validate in my action, and set the validateAnnotatedMethodOnly parameter in validation interceptor. So I wrote several annotated validators before some methods in my action, where contained some validators that had the same field name. I got the correct response when I used server validation only, but when I set the validate to true in the HTML, it generated several same part of validation Javascript for one field name that had the same field name.
> The generated Javascript as below:
> function validateForm_validateName() {
> form = document.getElementById("validateName");
> clearErrorMessages(form);
> clearErrorLabels(form);
> var errors = false;
> // field name: name
> // validator name: requiredstring
> if (form.elements['name']) {
> field = form.elements['name'];
> var error = "input name1 please!!";
> if (field.value != null && (field.value == "" || field.value.replace(/^\s+|\s+$/g,"").length == 0)) {
> addError(field, error);
> errors = true;
> }
> }
> // field name: name
> // validator name: requiredstring
> if (form.elements['name']) {
> field = form.elements['name'];
> var error = "input name2 please!!";
> if (field.value != null && (field.value == "" || field.value.replace(/^\s+|\s+$/g,"").length == 0)) {
> addError(field, error);
> errors = true;
> }
> }
> // field name: password
> // validator name: requiredstring
> if (form.elements['password']) {
> field = form.elements['password'];
> var error = "input password1 please!!";
> if (field.value != null && (field.value == "" || field.value.replace(/^\s+|\s+$/g,"").length == 0)) {
> addError(field, error);
> errors = true;
> }
> }
> // field name: password
> // validator name: requiredstring
> if (form.elements['password']) {
> field = form.elements['password'];
> var error = "input password2 please!!";
> if (field.value != null && (field.value == "" || field.value.replace(/^\s+|\s+$/g,"").length == 0)) {
> addError(field, error);
> errors = true;
> }
> }
> return !errors;
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.