当openFaces组件中的validationError=true时,具体的验证错误是什么?

What is the specific validation error when validationError=true in an openFaces component

本文关键字:验证 错误 是什么 true 组件 openFaces validationError      更新时间:2023-09-26

我正在使用openFaces的dateChooser,我设置了一个模式。如果我输入了一个错误的值(如:33/33/33),并尝试提交validationError被设置为true,因为错误的格式,但我不知道如何获得导致验证错误的特定错误消息或组件。

这是我的一部分代码:

<o:dateChooser 
    id="DateColBtnGeneralView" 
    pattern="#{configurationController.defaultDateFormat}"
    value="#{homeController.firstDate}">
    <f:convertDateTime pattern="#{configurationController.defaultDateFormat}"/>   
</o:dateChooser>
<o:commandButton
    action="#{homeController.submitDates}"
    onsuccess="contractClientDialogValidation(event)
    value="Submit" />
function contractClientDialogValidation (event) {
    if (event.validationError) {
        alert("I want to show you the right error message according to the wrong value and component");
    }
}

validationError在所需的组件为空或日期格式不正确或输入数字太长等情况下被设置为true

验证错误主要与JSF生命周期中的UpdateModelValues和InvokeApplication阶段相关。

在您的元素中,您可以选择使用标签。

当ajax请求/响应生命周期完成时,呈现标记。

见链接第3点