本文介绍了primefaces对话框不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试复制Primefaces展示柜中的primefaces ajax对话框形式
I am trying to replicate primefaces ajax dialog form as in Primefaces showcase
我的JSF代码段如下
<h:body>
<p:commandButton id="showDialogButton" type="button" value="Show"
onclick="PF('dlg').show()" />
<p:dialog header="Enter FirstName" widgetVar="dlg" appendToBody="true"
resizable="false">
<h:form id="form">
<h:panelGrid columns="2" style="margin-bottom:10px">
<h:outputLabel for="firstName" value="firstName:" />
<p:inputText id="firstName" value="#{backingBean.firstName}" />
</h:panelGrid>
<p:commandButton id="submitButton" value="Submit" update=":display"
oncomplete="PF('dlg').hide();" />
</h:form>
</p:dialog>
<p:outputPanel id="display" style="display:block;margin-top:10px;">
<h:outputText id="name" value="Hello #{backingBean.firstName}"
rendered="#{not empty backingBean.firstName}" />
</p:outputPanel>
我的托管bean
@ManagedBean
@ViewScoped
public class BackingBean implements Serializable{
private String firstName;
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
}
单击提交"按钮时没有显示对话框:(..我还添加了appendToBody ="true",但没有结果.例如,我收到了JavaScript错误,显示为"Object Object Expected".请帮助我解决此问题. /p>
No dialog is getting displayed on clicking submit button :(. I have also included appendToBody="true" but no result.In ie i get javascript error as "Object Expected". Please help me out to solve this issue.
推荐答案
您使用哪个版本的素字??
which version of primefaces you use ?
如果您使用Primefaces 3.5或更早版本:
If you use Primefaces 3.5 or older:
<p:commandButton id="showDialogButton" type="button" value="Show"
onclick="dlg.show()" />
对于Primefaces 4.0:
For Primefaces 4.0 :
<p:commandButton id="showDialogButton" type="button" value="Show"
onclick="PF('dlg').show()" />
这篇关于primefaces对话框不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!