Question

I Have a form where i am entering some details and all the details are important and essential. I used required=true to make sure it doesn't miss the essential information but when i click the submit button it skips the validation phase ..

what should i do ?

        <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>

OTHER TIPS

"immediate is to designate that listener fires before validation is performed or beans are populated" from the documentation, but I see no actionlisteners here!. When you used required that was right, and your code exactly worked when I put it in an but no requiredMessage shown,I also didnt see any effect to the ajax statement, I removed it all and nothing changed, you could put that requiredMessage in a bean string for other outputText and clear it programmatically using that ajax action, So try to put each inside a form, :

 <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>

Good luck.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top