Question

In my JSF form, I am using BlockUI to show the busy status while processing. It worked fine until I add javascript to the header. With the script tag, the BlockUI is not showing at all. How can I work around this? Following is my form with the javascripts in which blockUI is not working. I am using JSF 2.2, Primefaces 3.4.2 in Glassfish 3.2.2 and firefox browser.

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">
    <h:head>
        <title>TODO supply a title</title>
        <meta name="viewport" content="width=device-width"/>
        <script src="js/jquery.min.js"></script>
        <script src="js/classie.js"></script>
        <script src="js/menu.js"></script>               
        <script type="text/javascript">
            $(function() {
                $('#da-slider').cslider({
                    autoplay: true,
                    bgincrement: 450
                });
            });
        </script>
    </h:head>
    <h:body>
        <h:form id="registration"> 
            <h1> Sign up </h1> 
            <p:growl id="growl" showDetail="true" /> 
            <p:dialog header="Error registering user" widgetVar="dlg" resizable="false"/>
            <p:messages id="messages" autoUpdate="true" closable="true"/>
            <p:panel id="panel">
                <h:panelGrid id="grid" columns="2" cellpadding="4">  
                    <p:outputLabel for="username" value="Username:" />
                    <p:inputText id= "username" value="#{userBean.userId}" required="true">                      
                    </p:inputText>                 
                    <p:outputLabel for= "firstname" value="First Name: " />
                    <p:inputText id="firstname" value="#{userBean.firstName}" required="true"/>                   
                    <p:outputLabel for= "lastname" value="Last Name: " />
                    <p:inputText id= "lastname" value="#{userBean.lastName}" required="true"/>
                    <p:outputLabel for= "email" value="Email Address: " />
                    <p:inputText id= "email" value="#{userBean.email}" required="true"
                                 validatorMessage="Invalid email format" >
                    </p:inputText>
                    <p:outputLabel for= "organisation" value="Organisation:" />
                    <p:inputText id="organisation" value="#{userBean.organisation}" required="true"/>
                </h:panelGrid>
            </p:panel>
            <p class="signin button">
                <p:commandButton id="saveButton" value="Proceed" actionListener="#{userBean.createUser()}" onclick="#{userBean.validateForm()}" update="registration:panel @this"/>
                <p:commandButton value="Reset" update="registration:panel" process="@this" actionListener="#{userBean.resetButton()}"/>
            </p> 
            <p:blockUI block="panel" trigger="saveButton">  
                <p>Processing....</p>
                <p:graphicImage value="http://www.primefaces.org/showcase/images/loading.gif"/>  
            </p:blockUI>
        </h:form>
    </h:body>
</html>    
Was it helpful?

Solution

In your XHTML

<script src="js/jquery.min.js"></script>

PrimeFaces already ships with jQuery bundled, yet you've downloaded and installed another one which would only conflict with PrimeFaces bundled jQuery.

Remove above line i.e <script src="js/jquery.min.js"></script>

Try above and see if that helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top