Uploaded image for project: 'Hippo CMS'
  1. Hippo CMS
  2. CMS-14198

Validation messages don't work on Content Type Editor

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • 14.3.3
    • None
    • None
    • None

    Description

      Currently content type editor does some validations after a change in the fields and it is supposed to show error messages after a failed validation of a field. But error messages are not shown in the page as expected.

      There is an easy path to reproduce the case. If the path value of a document type field is left empty, then an error message is supposed to be shown according to the FieldEditor class.

      @Override
      public void setObject(final String path) {
          if (StringUtils.isBlank(path)) {
              final StringResourceModel errorModel = new StringResourceModel("error-path-cannot-be-blank", FieldEditor.this)
                      .setParameters(getDescriptor().getName());
              showError(errorModel.getString());
          } else {
              try {
                  if (path.indexOf(':') < 0) {
                      getDescriptor().setPath(prefix + ":" + path);
                  } else {
                      getDescriptor().setPath(path);
                  }
              } catch (final TypeException e) {
                  showError(e.getLocalizedMessage());
              }
          }
      }
      
      private void showError(final String msg) {
          error(msg);
          final Optional<AjaxRequestTarget> target = RequestCycle.get().find(AjaxRequestTarget.class);
          target.ifPresent(ajaxRequestTarget -> ajaxRequestTarget.add(FieldEditor.this));
      }
      

      I investigated why it doesn't work and I figured out that all the messages stored in the feedbackMessages are somehow get cleared before the ajax response message is returned.

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ekarakus Erdem Karakus
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: