I have a page inner.xhtml included in outer.xhtml using ui:include. The inner.xhtml has a p:commandLink whose oncomplete attribute opens a p:dialog.
inner.xhtml
<html>
<ui:composition>
<h:form>
<p:commandLink oncomplete="mydialog.show();" actionListener="listener method" process="@this">
</p:commandLink>
</h:form>
</ui:composition>
<p:dialog id="mydialogid" widgetVar="mydialog">
My Code For Dialog
</p:dialog>
</html>
outer.xhtml
<h:form>
<p:commandButton oncomplete="dlg.show();" actionListener="listener method" global="false"></p:commandButton>
</h:form>
<p:dialog id="dlgid" widgetVar="dlg" dynamic="true" appendTo="@(body)">
<ui:include src="inner.xhtml">
<ui:param name="idPrefix" value="par"/>
</ui:include>
</p:dialog>
The problem is that on click of commandlink in inner.xhtml i am getting this error
Uncaught ReferenceError: mydialog is not defined
And the dialog is not opening. How to fix this?
I am using primefaces 4.0