Reputation: 81
I need list of primefaces elements that need to be wraped by <h:form>
in order to be updated by any action of <p:ajax>
some primeface elements even if they have id and in <p:ajax update="thisID">
it still needs an <h:form>
with an id in ordered to be updated so which elements need <h:form>
and whick not
Upvotes: 0
Views: 3765
Reputation: 1108642
To the point, all components implementing the EditableValueHolder
interface and the ActionSource
interface needs to be enclosed in an UIForm
component.
In the aforelinked Javadocs you can find in the "All Known Implementing Classes" indications which components implement them. If you look closely, then you'll notice that it are all input components like inputText
, selectOneMenu
, etc and command components like commandLink
, commandButton
, etc. In the PrimeFaces API documentation, for example the InputText
which represents the <p:inputText>
implements EditableValueHolder
, so it should be placed in a form.
It's also exactly the same rerequirement as in plain vanilla HTML has, the HTML <input>
, <select>
, <textarea>
, etc should go in a <form>
in order to get value to be sent to the server side. HTML is also what JSF ultimately produces, after all.
As to updating elements by ajax, it's not true that the to-be-updated components needs to be placed inside a form. You can perfectly update content which is outside the current form. You can even update other forms.
Upvotes: 6
Reputation: 11537
This is a slight modification to PatrickT's Answer. You are able to update things outside the form also. But data you want to submit should be part of the form afaik.
<p:messages id="outsideForm" showDetail="true"></p:messages>
<h:form id="kalle">
<p:messages id="insideForm" showDetail="true"></p:messages>
<p:inputText required="true"></p:inputText>
<p:commandButton value="submit" update=":outsideForm,insideForm"/>
</h:form>
Upvotes: 2
Reputation: 409
Every component submitting/receiving Content from/to a backing bean needs to be wrapped by <h:form>
.
So everything you want to update or every Button / Link setting something needs to be inside a form. Also this isn't a Primefaces thing. This rules apply for normal JSF too.
Upvotes: -1