P: message Does not appear in p:

In p: dialog addCommodityDlg I have text fields. I am trying to show a validation message for these fields. But this did not succeed.

code:

  <p:dialog id="addCommodityDlg" widgetVar="createCommodity" width="625" height="400" modal="true" header="Add Items"> <h:panelGrid columns="3"> <h:outputLabel value="ID" /> <h:inputText value="#{deliveryOderController.selectedCommodity.commodityId}" id="commodityIdTF" required="true" /> <p:message for="commodityIdTF"/> <h:outputLabel value="Name"/> <h:inputText value="#{deliveryOderController.selectedCommodity.commodityName}" id="commodityNameTF"/> <p:message for="commodityNameTF"/> </h:panelGrid> <p:commandLink styleClass="saveButtonLnk" actionListener="#{deliveryOderController.saveItems}" update=":createDOForm:transportUnitPnl"> </p:commandLink> </p:dialog> 

How can I display a validation message in the p: dialog?

+4
source share
1 answer

Give these p:message components an identifier and put them in the update of your p:commandLink :

 <p:dialog id="addCommodityDlg" widgetVar="createCommodity" width="625" height="400" modal="true" header="Add Items"> ... <p:message id="commodityIdTFMessage" for="commodityIdTF"/> ... <p:message for="commodityNameTF" id="commodityNameTFMessage" /> </h:panelGrid> <p:commandLink styleClass="saveButtonLnk" actionListener="#{deliveryOderController.saveItems}" update=":createDOForm:transportUnitPnl commodityIdTFMessage commodityNameTFMessage"> </p:commandLink> </p:dialog> 
+5
source

All Articles