Error with <p:layout> and <p:messages/>

UI Components for JSF
Post Reply
uaiHebert
Posts: 31
Joined: 26 Jan 2011, 02:21

04 Feb 2011, 00:23

Hello. I am having a strange error with the code bellow:

Code: Select all

<h:body>
		<h:form prependId="false" >
			<f:view contentType="text/html">
				<p:layout fullPage="true" >
					<p:layoutUnit id="center" position="center">
						<h:panelGroup id="b">

							<h:panelGrid title="BBBB" style="padding-top:15px">
								<p:messages/>
								<h:message for="email"/>
								<h:messages/>
								<p:message for="email"/>

									<h:outputLabel value="aaaaa"/>
									<h:inputText id="email" value="" name="email" required="true" requiredMessage="error"/>
									<h:outputLabel value="asd"/>
									<h:inputText value="" required="true" requiredMessage="error"/>
									<p:commandButton value="Login" title="Login" actionListener="#{calendarBean.getDate1}" update="center"/>
							</h:panelGrid>
						</h:panelGroup>
					</p:layoutUnit>
				</p:layout>
			</f:view>
		</h:form>
    </h:body>
When I use the "p:commandButton" no validation is executed. When I use "h:commandButton" no action is executed.

BUT

when I remove the tags "p:layout" and "p:layoutUnit" the validation works fine.

What I am missing here? I am trying to use the "p:layout" as my templat but none of messages my messages get rendered.

Thanks.

User avatar
ydarcin
Posts: 258
Joined: 04 Jan 2009, 19:02
Location: Turkey

04 Feb 2011, 09:47

Hi,

can you try updating this panellGrid: <h:panelGroup id="b"> in commandButton?

like update="b"

Yigit

uaiHebert
Posts: 31
Joined: 26 Jan 2011, 02:21

04 Feb 2011, 15:17

Did not work. =/

Any other idea?

User avatar
kwintesencja
Posts: 316
Joined: 08 Feb 2010, 20:33
Location: Brazil

04 Feb 2011, 15:23

Hi, another idea is to use the form inside the units:

Code: Select all

<h:body>
         <f:view contentType="text/html">
            <p:layout fullPage="true" >
               <p:layoutUnit id="center" position="center">
                 <h:form id="centerForm" >
                  <h:panelGroup id="b">

                     <h:panelGrid title="BBBB" style="padding-top:15px">
                        <p:messages/>
                        <h:message for="email"/>
                        <h:messages/>
                        <p:message for="email"/>

                           <h:outputLabel value="aaaaa"/>
                           <h:inputText id="email" value="" name="email" required="true" requiredMessage="error"/>
                           <h:outputLabel value="asd"/>
                           <h:inputText value="" required="true" requiredMessage="error"/>
                           <p:commandButton value="Login" title="Login" actionListener="#{calendarBean.getDate1}" update="centerForm:b"/>
                     </h:panelGrid>
                  </h:panelGroup>
               </form>
               </p:layoutUnit>
            </p:layout>
         </f:view>
    </h:body>

I hope it helps
Att,

--

Rafael Mauricio Pestano


Primefaces 5.x + JavaEE7(Glassfish 4.x and Wildfly 8)
Conventions Framework
Blog
@realpestano

uaiHebert
Posts: 31
Joined: 26 Jan 2011, 02:21

04 Feb 2011, 15:29

It worked! Thanks.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 49 guests