首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >验证阶段绕过

验证阶段绕过
EN

Stack Overflow用户
提问于 2014-05-12 06:53:25
回答 2查看 113关注 0票数 1

我有一个表格,在那里我要输入一些细节,所有的细节都是重要和必要的。我使用required=true确保它不会遗漏基本信息,但是当我单击submit按钮时,它会跳过验证阶段。

我该怎么办?

代码语言:javascript
复制
        <h:panelGrid id="offline" columns="2" cellspacing="5"
                cellpadding="4" style="position:relative;top:25px;left:40%;">
                <p:outputLabel value="Cheque / Draft No  :"
                    style='font-family: font-family : Baskerville, "Baskerville Old Face",
    "Hoefler Text", Garamond, "Times New Roman", serif;;
font-size: 15px;height:23px;widht:255px;'></p:outputLabel>
                <p:outputLabel value="Cheque / Draft Date  :"
                    style='font-family: font-family : Baskerville, "Baskerville Old Face",
    "Hoefler Text", Garamond, "Times New Roman", serif;;
font-size: 15px;height:23px;widht:255px;'></p:outputLabel>
                <p:inputText id="number"
                    style='font-family: font-family : Baskerville, "Baskerville Old Face",
    "Hoefler Text", Garamond, "Times New Roman", serif;;
font-size: 13px;height:20px;widht:320px;'
                    value="#{Offline_Payment.chequedraftno}" required="true"
                    requiredMessage="Please Enter The Details">
                    <p:ajax process="@this" immediate="true"></p:ajax>
                </p:inputText>
                <p:calendar id="date"
                    style='font-family: font-family : Baskerville, "Baskerville Old Face",
    "Hoefler Text", Garamond, "Times New Roman", serif;;
font-size: 13px;height:20px;widht:320px;'
                    pattern="yyyy-MM-dd" disabledWeekends="true" navigator="true"
                    value="#{Offline_Payment.chequedraftdate}"
                    title="Please Enter the date in yyyy-MM-dd" required="true"
                    requiredMessage="Please Enter The Details">

                </p:calendar>
                <p:outputLabel value="Bank Name  :"
                    style='font-family: font-family : Baskerville, "Baskerville Old Face",
    "Hoefler Text", Garamond, "Times New Roman", serif;;
font-size: 15px;height:23px;widht:255px;'></p:outputLabel>
                <p:outputLabel value="Bank Code  :"
                    style='font-family: font-family : Baskerville, "Baskerville Old Face",
    "Hoefler Text", Garamond, "Times New Roman", serif;;
font-size: 15px;height:23px;widht:255px;'></p:outputLabel>
                <p:inputText id="banknane"
                    style='font-family: font-family : Baskerville, "Baskerville Old Face",
    "Hoefler Text", Garamond, "Times New Roman", serif;;
font-size: 13px;height:20px;widht:320px;'
                    value="#{Offline_Payment.bankname}" required="true"
                    requiredMessage="Please Enter The Details">
                    <p:ajax process="@this" immediate="true"></p:ajax>

                </p:inputText>
                <p:inputText
                    style='font-family: font-family : Baskerville, "Baskerville Old Face",
    "Hoefler Text", Garamond, "Times New Roman", serif;;
font-size: 13px;height:20px;widht:320px;'
                    value="#{Offline_Payment.bankcode}" required="true"
                    requiredMessage="Please Enter The Required Details">

                    <p:ajax process="@this" immediate="true"></p:ajax>
                </p:inputText>

                <p:commandButton value="Cancel"
                    style='font-family: font-family : Baskerville, "Baskerville Old Face",
    "Hoefler Text", Garamond, "Times New Roman", serif;;
font-size: 14px;'
                    immediate="true"
                    action="/User/orderdetail.xhtml?faces-redirect=true"></p:commandButton>
                <p:commandButton value="Proceed"
                    style='font-family: font-family : Baskerville, "Baskerville Old Face",
    "Hoefler Text", Garamond, "Times New Roman", serif;;
font-size: 14px;'
                    action="#{Offline_Payment.offline}" update="@this,growl"
                immediate="false"   validateClient="true" process="@this"></p:commandButton>
            </h:panelGrid>
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2014-05-12 10:03:06

问题是您使用了immediate="true"属性。

请查看以下链接:

票数 1
EN

Stack Overflow用户

发布于 2014-05-12 11:28:53

“立即从文档中指定监听器在执行验证或填充bean之前触发”,但我在这里没有看到任何actionlisteners!当您使用required是正确的,当我将它放入一个但没有显示的requiredMessage中时,您的代码完全正常工作,我也没有看到任何对ajax语句的影响,我删除了它,没有任何改变,您可以将这个requiredMessage放入一个bean字符串中,用于其他outputText,然后使用该ajax操作以编程方式清除它,所以尝试将每个requiredMessage放在一个表单中:

代码语言:javascript
复制
 <h:form>
    <p:inputText
   value="#{Offline_Payment.bankcode}" required="true"
                    requiredMessage="Please Enter The Required Details">

                    <p:ajax process="@this" immediate="true"></p:ajax>
                </p:inputText>
</h:form>

祝好运。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23602744

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档