HELP! message in dialog

UI Components for JSF
Post Reply
rippal
Posts: 19
Joined: 26 Jan 2011, 15:59

14 Mar 2011, 17:54

hello friends of jsf!

i need your help!

in my application i have some dialogs.. my problem is that the messages aren't shown because i have the attribute oncomplete="dialog.hide()"

but.. how can i check if all inputs are valid???
the dialog also hides when there should be shown a message..

here is my dialog:

Code: Select all

		<p:dialog id="dialog" header="Dialog"
			widgetVar="dialog" modal="true" draggable="false" closable="false"
			resizable="false" width="400" height="400">
			<h:form>
				<h:panelGrid columns="1" cellpadding="5">
					<p:fieldset legend="Allgemein">
						<h:outputLabel for="name" value="Name:" />
						<h:inputText id="name" value="#{bean.name}" required="true" />
					</p:fieldset>
					<p:messages></p:messages>
					<p:commandButton value="Add" action="#{bean.action}" oncomplete="dialog.hide()" />
				</h:panelGrid>
			</h:form>
		</p:dialog>
my goal is that the dialog should keep visible when an error (for example the required-attribut) appears!

please. i need your help!

thank you very much!

User avatar
Hericksnake
Posts: 47
Joined: 21 Jan 2011, 22:45
Location: Brasil

14 Mar 2011, 18:09

Try this:

Code: Select all

  <p:dialog id="dialog" header="Dialog"
         widgetVar="dialog" modal="true" draggable="false" closable="false"
         resizable="false" width="400" height="400" visible="#{not empty facesContext.maximumSeverity}" >
         <h:form>
            <h:panelGrid columns="1" cellpadding="5">
               <p:fieldset legend="Allgemein">
                  <h:outputLabel for="name" value="Name:" />
                  <h:inputText id="name" value="#{bean.name}" required="true" />
               </p:fieldset>
               <p:messages></p:messages>
               <p:commandButton value="Add" action="#{bean.action}" update="dialog"/>
            </h:panelGrid>
         </h:form>
      </p:dialog>

I just changed your oncomplete to update and add a "visible="#{not empty facesContext.maximumSeverity}" " to your dialog.
Maybe this should work.
Primefaces 3.2
JSF 2.0
Glassfish Server 3.1.2
Netbeans7.1.1

mattharr
Posts: 20
Joined: 01 Feb 2011, 04:49

14 Mar 2011, 22:19

Or try:

Code: Select all

<p:commandButton value="Add" action="#{bean.action}" oncomplete="if (!args.validationFailed) {dialog.hide();}" />
Note that you'll also need to update your form to show the messages on screen.

Cheers,

Matt

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

14 Mar 2011, 23:30

I think the login demo best fits your case

http://www.primefaces.org/showcase/ui/dialogLogin.jsf
Att,

--

Rafael Mauricio Pestano


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

Jedditle
Posts: 1
Joined: 12 Mar 2011, 19:33
Location: United States
Contact:

15 Mar 2011, 00:10

I think the login demo best fits your casehttp://www.primefaces.org/showcase/ui/dialogLogin.jsf

:(

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 29 guests