validator property not fireing validator method
-----------------------------------------------
Key: TOMAHAWK-1276
URL: https://issues.apache.org/jira/browse/TOMAHAWK-1276
Project: MyFaces Tomahawk
Issue Type: Bug
Components: Validators
Affects Versions: 1.1.6
Environment: WinXp, MyFaces 1.2.3, Tomcat 6.0.14, Java jdk1.6.0_03,
JSF On JSP
Reporter: David Waters
Priority: Critical
on at least t:inputHidden the validator has no effect.
Simple Example
<[EMAIL PROTECTED] 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.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.