Non-Global Confirm Dialog show function not working after upgrade

UI Components for JSF
Post Reply
aveyD6
Posts: 3
Joined: 09 Mar 2018, 21:55

09 Mar 2018, 22:48

Hi,

I'm upgrading from Primefaces 5.2 -> 6.2 and I'm having issues with the confirm dialog box not showing up. When i click the command button I expect the confirm dialog box to show up but instead i see the following error in the console:

Code: Select all

Uncaught TypeError: Cannot read property 'style' of undefined
    at c.show (VM7398 components.js.xhtml:13)
...
Looking at the components.js from Primefaces 6.2 version i see the show function of PrimeFaces.widget.Dialog:

Code: Select all

    show: function() {
        if (this.isVisible()) {
            return
        }
        if (!this.loaded && this.cfg.dynamic) {
            this.loadContents()
        } else {
            if (this.cfg.fitViewport) {
                this.fitViewport()
            }
            if (this.positionInitialized === false) {
                this.jqEl.style.visibility = "hidden";
                this.jqEl.style.display = "block";
                this.initPosition();
                this.jqEl.style.display = "none";
                this.jqEl.style.visibility = "visible"
            }
            this._show()
        }
    },
The issue lies on this line:

this.jqEl.style.visibility = "hidden";

This is because "this.jqEl" is undefined. As part of the init function of PrimeFaces.widget.Dialog "this.jqEl" is set by:

Code: Select all

this.jqEl = this.jq[0];
But this.jq[0] is undefined as well. Primefaces 5.2 had primefaces.js and the show function looked like this:

Code: Select all

    show: function() {
        if (this.isVisible()) {
            return
        }
        if (!this.loaded && this.cfg.dynamic) {
            this.loadContents()
        } else {
            if (!this.positionInitialized) {
                this.initPosition()
            }
            this._show()
        }
    },
So if we require "this.jqEl" to be set properly what could I be missing? Here is my command button and dialog box for reference:

Code: Select all

<h:form>
...
<p:commandButton onclick="PF('submitDialog').show()" value="Submit" />

<p:confirmDialog widgetVar="submitDialog" header="Confirmation"
	message="Are you sure you want to submit this record?"
	showEffect="fade" hideEffect="fade" severity="alert">
    <p:commandButton value="Yes" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" ajax="false"
    	action="#{controller.submit}" oncomplete="PF('submitDialog').hide()" />
    <p:commandButton value="No" styleClass="ui-confirmdialog-no" icon="ui-icon-close"
    	oncomplete="PF('submitDialog').hide()" />
</p:confirmDialog>
...
</h:form>
I am using JSF 2.0 and Weblogic 11g.

Thanks

David

Drake
Posts: 44
Joined: 25 Jan 2011, 10:59

13 Mar 2018, 12:07

Same problem migrating from 6.1 to 6.2
WildFly 10.1.0 Final, Mojarra 2.2.15 PrimeFaces 6.2

kukeltje
Expert Member
Posts: 9116
Joined: 17 Jun 2010, 13:34
Location: Netherlands

13 Mar 2018, 12:26

in many of the cases this is related to duplicate jquery or even duplicate PrimeFaces version in the deployed app
Ronald van Kuijk
______________________________
PrimeFaces 6.1, PrimeFaces plus 0.0.2 | JbossWildfly 10.1| Mojarra 2.2.13
Fedora 61, Firefox 'most recent'
Read the forum posting rules
Beginners: https://jsf.zeef.com/bauke.scholtz

aveyD6
Posts: 3
Joined: 09 Mar 2018, 21:55

13 Mar 2018, 16:30

kukeltje wrote:
13 Mar 2018, 12:26
in many of the cases this is related to duplicate jquery or even duplicate PrimeFaces version in the deployed app
In the sources tab in Chrome developer tools i see the javax.faces.resources folder with a jquery folder and it has jquery-plugins.js and jquery.js (I'm assuming there is no overlap with these 2). At the root of the javax.faces.resouces folder there is components.js and core.js (from primefaces) and jsf.js.

Any other thoughts?
Thanks

Drake
Posts: 44
Joined: 25 Jan 2011, 10:59

14 Mar 2018, 15:32

In our EAR there is only a primefaces.jar and in we have no explicit import of jQuery...
Since we are hurry, we used <p:dialog> styled look alike <p:confirmDialog> as workaround
WildFly 10.1.0 Final, Mojarra 2.2.15 PrimeFaces 6.2

tandraschko
PrimeFaces Core Developer
Posts: 3462
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

14 Mar 2018, 15:38

I would like to fix the bug but impossible without a small as possible replicator.
Always Bet On Prime (+ Extensions)!

Thomas Andraschko
PrimeFaces Developer | PrimeFaces Extensions Founder
Apache OpenWebBeans PMC | Apache DeltaSpike PMC | Apache MyFaces PMC

Personal Blog: http://tandraschko.blogspot.de/

aveyD6
Posts: 3
Joined: 09 Mar 2018, 21:55

15 Mar 2018, 15:56

tandraschko wrote:
14 Mar 2018, 15:38
I would like to fix the bug but impossible without a small as possible replicator.
If the primefaces showcase had a sample with a non-global confirmDialog you could probably easily reproduce this. Global confirm dialog's and regular dialog's work fine, just not non-global confirmDialogs. I have also converted my confirmDialog's into regular dialog's until this bug is fixed.

tandraschko
PrimeFaces Core Developer
Posts: 3462
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

15 Mar 2018, 16:06

Feel free to create a sample and provide a PR, so we can easily test in the future.
Always Bet On Prime (+ Extensions)!

Thomas Andraschko
PrimeFaces Developer | PrimeFaces Extensions Founder
Apache OpenWebBeans PMC | Apache DeltaSpike PMC | Apache MyFaces PMC

Personal Blog: http://tandraschko.blogspot.de/

sakkie6yster
Posts: 80
Joined: 23 Nov 2011, 08:46

13 Aug 2018, 19:45

kukeltje wrote:
13 Mar 2018, 12:26
in many of the cases this is related to duplicate jquery or even duplicate PrimeFaces version in the deployed app
Hi Kukeltje,

Do you perhaps know of a way to spot these duplicates in the application?
I can't see any duplication/conflicting jquery JS files (using Developer tools "Network" tab). The files jquery.js, jquery-plugin.js and core.js all in Primefaces version 6.2 and no duplicates. Unless I'm looking in the wrong place to try and find these duplicates?

We are in the process of migrating from Primefaces 5.3 to 6.2 and as far as I can see this is the last "show-stopper". :)
I am getting the same error (see below) when trying to show a confirmDialog.

Code: Select all

onclick="PF('confirmation').show()"
Uncaught TypeError: Cannot read property 'style' of undefined
at c.show (components.js?ln=primefaces&v=6.2:13)
at HTMLAnchorElement.onclick (home.xhtml:141)
show @ components.js?ln=primefaces&v=6.2:13
onclick @ home.xhtml:141


I created a standalone simple example, but the confirmDialog worked without any issues. So starting to believe that this must be some duplication as indicated by you. In my standalone application (a simple war), my dependencies were primefaces and the jsf-api:

Code: Select all

		<!-- Primefaces -->
		<dependency>
			<groupId>org.primefaces</groupId>
			<artifactId>primefaces</artifactId>
			<version>6.2</version>
			<scope>compile</scope>
		</dependency>

		<!-- JSF -->
		<dependency>
			<groupId>com.sun.faces</groupId>
			<artifactId>jsf-api</artifactId>
			<version>2.2.17</version>
		</dependency>
In the application (that is broken), we have jboss-javaee-web-7.0 as the dependency. Not sure if this might be where the problem lies?

Code: Select all

		<!-- Primefaces -->
		<dependency>
			<groupId>org.primefaces</groupId>
			<artifactId>primefaces</artifactId>
			<version>6.2</version>
			<scope>compile</scope>
		</dependency>

		<!-- JBoss Javaee Web -->
		<dependency>
			<groupId>org.jboss.spec</groupId>
			<artifactId>jboss-javaee-web-7.0</artifactId>
			<version>1.1.0.Final</version>
			<type>pom</type>
			<scope>provided</scope>
		</dependency>

We are using Wildfly-10 btw.
Primefaces 5.3, Extensions 4.0.0
Glassfish 3.1.2.2, Wildfly-10.0.0.Final
JSF 2.2

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 8 guests