Uploaded image for project: 'MyFaces Tomahawk'
  1. MyFaces Tomahawk
  2. TOMAHAWK-1276

validator property not fireing validator method

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Duplicate
    • 1.1.6
    • None
    • Validators
    • None
    • WinXp, MyFaces 1.2.3, Tomcat 6.0.14, Java jdk1.6.0_03, JSF On JSP

    Description

      on at least t:inputHidden the validator has no effect.
      Simple Example

      <%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
      <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>

      <f:view>
      <html>
      <head></head>
      <body>
      <h:form id="testForm">
      <h:messages />
      <t:inputHidden value="123321" id="tomHiddenField" validator="#

      {test.tomNeverValid}

      " required="true" />
      <h:inputHidden value="123321" id="jsfHiddenField" validator="#

      {test.jsfNeverValid}

      " required="true"/>

      <h:commandButton value="Test" id="btn" />
      </h:form>
      </body>
      </html>
      </f:view>

      public class Test{
      private static final Logger logger = Logger.getLogger(Test.class);

      public void tomNeverValid(FacesContext context, UIComponent comp, Object value)

      { logger.error("This is never called"); throw new ValidatorException(new FacesMessage("This does not show.")); }

      public void jsfNeverValid(FacesContext context, UIComponent comp, Object value)

      { logger.debug("This Jsf Validator Called"); throw new ValidatorException(new FacesMessage("This does show.")); }

      }

      Actual Behaviour:
      On clicking the button to submit this form only one validation message is display, "This does show" this is produced by the h:inputhidden

      Expected Behaviour:
      On clicking the button to submit this form only both validation message are displayed

      Notes: The h:inputHidden ends up adding a validator to the validators collection not storing the validate express ion directly see
      org.apache.myfaces.taglib.html.HtmlInputHiddenTag.setProperties()
      if (_validator != null)
      {
      comp.addValidator(new MethodExpressionValidator(_validator));
      }

      org.apache.myfaces.shared_tomahawk.taglib.UIComponentTagBase.setProperties(..)
      calls
      org.apache.myfaces.shared_tomahawk.taglib.UIComponentTagUtils.setValidatorProperty(...) stores on calls UIInput.setValidator
      this._validator = validator;

      in UIInput ._validator is not mentioned in saveState or restoreState.

      Note: this functionality worked in MyFaces 1.2.0, upgrading to MyFaces 1.2.3 broke this, I belive this will effect all input tags.

      Attachments

        Activity

          People

            lu4242 Leonardo Uribe
            dwat001 David Waters
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: