Validation problem with JSF h:form and PrimeFaces p:dialog?

"YOU AND THE ART OF ONLINE DATING" is the only product on the market that will take you step-by-step through the process of online dating, provide you with the resources to help ensure success. Get it now!

First of all is that you cannot embed one form in another. I think it is not valid html.

Up vote 0 down vote favorite 1 share g+ share fb share tw.

I have a JSF page that is basically a create form. The form consists of a variety of input fields and also a list of sub-elements. To add a sub-element, you click the "add element" link which pops up a dialog box using the PrimeFaces p:dialog tag.

It's similar to the login panel demo on the prime faces page here, complete with the p:growl validation messages: primefaces.org/showcase/ui/dialogLogin.jsf My problem is, when I click "add" in the dialog box I see growl validation messages for the fields in the dialog box and also the fields on the main form. I only want to see the messages for the dialog box. Is there a way to do this?

I tried embedding a form within a form, but it didn't work. That is, I tried ... ... but that didn't work. Any help is greatly appreciated!

Jsf primefaces link|improve this question edited Mar 7 '11 at 14:54 asked Mar 7 '11 at 14:48Robert Hume7451819 85% accept rate.

First of all is that you cannot embed one form in another. I think it is not valid html. P:growl behaves like h:messages.

It shows messages for all elements of the page (not limited to one form). You can limit it to global messages only (messages with no id) by setting the globalOnly="true" attribute. Change your commandButton to update only the p:growl and make sure that it is an ajax request that is fired by your commandButton (ajax=true).

The p:commandButton has ajax=true as default behaviour. So if you didn't change it explicitly, then it is an ajax request.

I did everything you said. And it works but I still have my side effect. Not sure the best way to approach it.

Imagine it this way: I have a form with a "Full Name" field and a "Phone Numbers" list (in a h:dataTable). To add a phone number to the list, click "Add Phone Number" and the dialog box appears, enter a phone number in dialog box and click the "Add" button. The problem is the growl shows me the validation message "Value required for Full Name" because it's validating all fields on the page, not just the ones on the dialog box.

The "Add" is an ajax request. – Robert Hume Mar 7 '11 at 15:22 Ah, I think you should put the input field for the full name in a different form than the dialog. If you submit a form, all elements will be validated even if only a subset is updated.

So use two forms (not nested! ). – Matt Handy Mar 7 '11 at 18:21 Thats it, two forms, not nested works!

Thanks Matt! – Robert Hume Mar 7 '11 at 18:52.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions