pe:inputPhone validatorMessage 属性被忽略
我的项目中的 PrimeFaces Extensions pe:inputPhone
代码如下。 当电话号码无效时,我希望有一条自定义验证器消息。但是 validatorMessage
属性不起作用,并且始终显示标准属性。有谁知道我该如何解决它?
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:ic="http://ivyteam.ch/jsf/component"
xmlns:p="http://primefaces.org/ui"
xmlns:pe="http://primefaces.org/ui/extensions">
<h:body>
<ui:composition template="/layouts/frame-8.xhtml">
<ui:define name="title">UiTesting</ui:define>
<ui:define name="content">
<h:outputStylesheet name="testing.css" />
<h:form id="form">
<p:growl/>
<p:messages />
<pe:inputPhone value="" id="telefon" initialCountry="de" widgetVar="phonenumber"
requiredMessage="Phone required"
validatorMessage="Number not valid"
required="true" onchange="this.value=PF('phonenumber').getNumber();"
data-cy="phonenumber" formatOnDisplay="false">
</pe:inputPhone>
</h:form>
</ui:define>
</ui:composition>
</h:body>
</html>
I have this code here for the PrimeFaces Extensions pe:inputPhone
in my project.
I want to have a custom validator message when the phone number is not valid. However the validatorMessage
attribute is not working and the standard one is always showing. Does anyone know how I could solve it?
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:ic="http://ivyteam.ch/jsf/component"
xmlns:p="http://primefaces.org/ui"
xmlns:pe="http://primefaces.org/ui/extensions">
<h:body>
<ui:composition template="/layouts/frame-8.xhtml">
<ui:define name="title">UiTesting</ui:define>
<ui:define name="content">
<h:outputStylesheet name="testing.css" />
<h:form id="form">
<p:growl/>
<p:messages />
<pe:inputPhone value="" id="telefon" initialCountry="de" widgetVar="phonenumber"
requiredMessage="Phone required"
validatorMessage="Number not valid"
required="true" onchange="this.value=PF('phonenumber').getNumber();"
data-cy="phonenumber" formatOnDisplay="false">
</pe:inputPhone>
</h:form>
</ui:define>
</ui:composition>
</h:body>
</html>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
感谢您报告此问题。它将在 PrimeFaces Extensions 11.0.3 中修复。
另请参阅:
请注意,您需要将
libphonenumber
依赖项添加到您的项目中,以便能够验证电话号码。在 11.0.3 发布之前,您可以创建自定义验证器并将其用作解决方法。
Thanks for reporting this issue. It will be fixed in PrimeFaces Extensions 11.0.3.
See also:
Please note that you will need to add the
libphonenumber
dependency to your project in order to be able to validate phone numbers.Until 11.0.3 is released, you could create a custom validator and use that as a workaround.