0

I am getting a javacript error when I click on the p:commandButton to display a p:dialog.

Please find the errors below:

Message: Object doesn't support this property or method
Line: 1
Char: 169
Code: 0
URI: http://localhost:8080/idm/javax.faces.resource/dialog/dialog.js.xhtml?     ln=primefaces&v=2.2.1

Message: Object doesn't support this property or method
 Line: 1
 Char: 133
 Code: 0
 URI: http://localhost:8080/idm/javax.faces.resource/button/button.js.xhtml?ln=primefaces&v=2.2.1

Here is the code block:

     <ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.prime.com.tr/ui" 
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core">

<p:commandButton value="save"  onclick="dlg1.show();" ></p:commandButton>
     <p:dialog id="basicDialog" header="Basic Dialog" widgetVar="dlg1">  
  <h:outputText value="Resistance to PrimeFaces is futile!" />  
</p:dialog>
      </ui:composition>

All the other primefaces components are working fine.

Any help would be appreciated.

2
  • Is this an old and existing webapp or are you just starting with PrimeFaces? 2.2.1 is a very ancient version and it's not recommended to get started with outdated libraries. As to the problem, are you manually including another copy of jQuery or so? Commented Jun 28, 2013 at 13:47
  • Yes we are using PrimeFaces 2.2.1 version. we have to use this version only for developing our application. Yes we are using another copy of jQuery, but we want to know in which file we need to change for displaying primefaces dialog... can you please help me out on this. Commented Jun 28, 2013 at 13:53

1 Answer 1

2

Yes we are using another copy of jQuery

Remove it. PrimeFaces as being a JSF component library based on top of jQuery/jQuery UI already auto-includes its bundled jQuery file for among others the dialog component. Multiple copies of jQuery would only conflict with each other, resulting in the kind of JS errors like the one you're facing.

If you intend to use jQuery on pages which do not necessarily use PrimeFaces components which auto-include the PrimeFaces-bundled jQuery file, then add this line to <h:head>.

<h:outputScript library="primefaces" name="jquery/jquery.js" />

This way PrimeFaces-bundled jQuery file is always included and PrimeFaces won't auto-include duplicate jQuery files if some PrimeFaces component happen to require it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.