p:message does not display intputText's requiredMessage

Forum rules
Please note that response time for technical support is within 3-5 business days.
Post Reply
JeeDev_User
Posts: 100
Joined: 26 Sep 2019, 11:02

01 Jan 2021, 14:17

Hi,

I am unable to see requiredMessage for p:inputText.
Here is relevant UI part:

Code: Select all

                           <p:dialog header="..." width="450" showEffect="fade"
                                   responsive="true"
                                   id="dlg_tabB1"
                                   closable="false"
                                   dynamic="true" >
                                  
                            <p:outputPanel id="manage-product-content" class="ui-fluid">
                                <p:outputPanel rendered="#{not empty cdiBean.selectedApp}">
                                    <div class="p-field">
                                        <p:outputLabel for="name">Name</p:outputLabel>
                                        <p:inputText id="name" value="#{cdiBean.selectedApp.naziv}" required="true" requiredMessage="Enter name" />
                                        <p:message  for="name"/>
                                    </div>
Pay attention on:

<p:inputText id="name" value="#{cdiBean.selectedApp.naziv}" required="true" requiredMessage="Enter name" />
<p:message for="name"/>


At runtime, when I omit the Name, only inputText become in red color, but I am unable to see "Enter name" required message.
In fact, in entire Rain demo app, there is no p:message at all, I'm starting to wonder if this is a problem with the template?

JeeDev_User
Posts: 100
Joined: 26 Sep 2019, 11:02

05 Jan 2021, 12:05

Wondering, do I need a premium support, in order to get an answer in less than 5 days?

mert.sincan
Posts: 5281
Joined: 29 Jun 2013, 12:38

06 Jan 2021, 05:15

Unfortunately, I couldn't replicate this issue. Please try;
empty.xhtml

Code: Select all

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                template="/WEB-INF/template.xhtml">

    <ui:define name="title">Empty Page</ui:define>

    <ui:define name="viewname">
        <li>PAGES</li>
        <li><i class="pi pi-chevron-right"></i></li>
        <li>
            <p:link outcome="/empty">EMPTY</p:link>
        </li>
    </ui:define>

    <ui:param name="viewname" value="EMPTY PAGE" />

    <ui:define name="content">
        <div class="p-grid">
            <div class="p-col">
                <div class="card">
                    <h:form id="form">
                        <div class="p-field">
                            <p:outputLabel for="name">Name</p:outputLabel>
                            <p:inputText id="name" value="#{testView.test}" required="true" requiredMessage="Enter name" />
                            <p:message for="name"/>

                            <p:commandButton value="Submit" update="@form"/>
                        </div>
                    </h:form>
                </div>
            </div>
        </div>
    </ui:define>

</ui:composition>

Code: Select all

...
public class TestView implements Serializable {
    
    private String test; // getter; setter;
    ...

JeeDev_User
Posts: 100
Joined: 26 Sep 2019, 11:02

13 Jan 2021, 13:11

Hi and thanks for reply.
Are you tried with p:inputText and p:message on the p:dialog?

For example, in provided demo, there is crud.xhtml
Inside that page, there is p:dialog.
Try to make some inputText to be required, and provide requiredMessage and p:message

JeeDev_User
Posts: 100
Joined: 26 Sep 2019, 11:02

19 Jan 2021, 08:34

Any info about this?

tugce.kucukoglu
Posts: 560
Joined: 23 Oct 2020, 09:28

19 Jan 2021, 10:59

Hi,

@burak Could you please check this issue?

Best regards,

siris
Posts: 322
Joined: 29 Jul 2019, 13:57

20 Jan 2021, 04:39

Hi,

Sorry for delayed response!

I tried with your example. The problem in your example is that "p: message" is not updated automatically. This issue is not theme-related and is also present in primefaces 8 when you do dialog + outputpanels + message combo. This way you can fix the problem.

Code: Select all

<p:dialog header="..." width="450" showEffect="fade"
          responsive="true"
          closable="true"
          dynamic="true">

    <p:outputPanel id="manage-product-content" class="ui-fluid">
        <div class="p-field">
            <p:outputLabel for="name">Name</p:outputLabel>
            <p:inputText id="name" value="#{testview.name}" required="true" requiredMessage="Enter name"/>
            <p:message id="msg" for="name" rendered="true"/>
            <p:commandButton value="Submit" update="manage-product-content"/>
        </div>
    </p:outputPanel>
</p:dialog>
Best Regards,

Post Reply

Return to “Rain - PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests