我有這樣的片段:PrimeFaces內p嵌套形式:與appendTo =「@(身體)對話框
<h:form id="form">
<!-- other content -->
<p:panel id="panel" header="test">
<p:inputText id="input1" value="#{viewScope.prop1}" required="true" />
<p:commandButton id="button1" process="@form" update="@form @widgetVar(dialog)"
oncomplete="PF('dialog').show()" value="ok" />
</p:panel>
<!-- other content -->
</h:form>
<p:dialog id="dialog" header="dialog" widgetVar="dialog" modal="true">
<h:form id="form2">
<p:inputText id="input2" value="#{viewScope.prop1}" required="true" />
<p:commandButton id="button2" process="@form" update="@form" value="ok" />
</h:form>
</p:dialog>
和所有工作正常
我想什麼來實現的就是這個。 :
<h:form id="form">
<!-- other content -->
<!-- fragment start -->
<!-- this fragment will be on its own file and included via ui:include (or inside composite component) -->
<p:panel id="panel" header="test">
<p:inputText id="input1" value="#{viewScope.prop1}" required="true" />
<p:commandButton id="button1" process="@form" update="@form @widgetVar(dialog)"
oncomplete="PF('dialog').show()" value="ok" />
</p:panel>
<p:dialog id="dialog" header="dialog" widgetVar="dialog" modal="true" appendTo="@(body)">
<h:form id="form2">
<p:inputText id="input2" value="#{viewScope.prop1}" required="true" />
<p:commandButton id="button2" process="@form" update="@form" value="ok" />
</h:form>
</p:dialog>
<!-- fragment end -->
<!-- other content -->
</h:form>
,但我沒有成功嘗試的process
和update
一些組合爲button1
產生過程什麼... input1
甚至重置...
那麼,如何建立一個p:dialog
,可以在一個片段或複合材料組件內運輸,並從外部排除form
?
注意,使用:
<h:form id="form">
<!-- other content -->
<ui:include src="panel.xhtml" />
<!-- other content -->
</h:form>
<ui:include src="dialog.xhtml" />
不是可接受的解決方案。
我在JSF 2.2.8(鑽嘴魚科)和PF 5.1
我想不接受開始包含並結束? :)對我來說,無論如何你都會得到嵌套的表格 –
2014-10-28 18:39:14
不,不允許:)但是我不想避免嵌套表格,我試圖讓它們在appendTo屬性的幫助下工作。根據PF對話文檔,這應該是可能的。 – 2014-10-29 01:34:58
但是不是嵌套形式是什麼給你帶來麻煩?我總是期望它會通過appendTo在輸出的html中不起作用。在primefaces論壇上有一些關於它的討論,也許你可以在那裏找到一些東西 – 2014-10-29 05:40:29