Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-2721

Ajax Validation does not work with ModelDriven Actions

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.2
    • Fix Version/s: 2.1.3
    • Component/s: Core Interceptors
    • Labels:
      None

      Description

      The JSON-Object returned by interceptor org.apache.struts2.interceptor.validation.JSONValidationInterceptor returns the fieldnames of failed validation-elements with the prefix 'model.' but the JS-Scripts (/struts/utils.js, /struts/xhtml/validation.js, /struts/css/validation.js) do not "know" about the ModelDriven-Concept. As a consequence, the ajax-validation worked correctly but the JS-Script do an alert "Can't validate myform_password". So it's either the intercptor or the scripts which have a bug.

      Imho the interceptor should be fixed. My workaround was this:
      Line 169:
      if(validationAware instanceof ModelDriven)
      sb.append(fieldError.getKey().substring(6));
      else
      sb.append(fieldError.getKey());

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              wschroeder Wolfgang Schröder
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: