Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8325217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:21:28+00:00 2026-06-09T00:21:28+00:00

I have a JSF page with Datepicker. The problem is when I use AJAX

  • 0

I have a JSF page with Datepicker. The problem is when I use AJAX to update the data into the page. After I execute AJAX action the page is datepicker is not working:

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"    
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">
    <h:head>
        <ui:insert name="header">           
            <ui:include src="header.xhtml"/>         
        </ui:insert>       
    </h:head>
    <h:body>
        <h1><img src="resources/css/images/icon.png" alt="DX-57" /> Account Center</h1>
        <!-- layer for black background of the buttons -->
        <div id="toolbar" style="margin: 0 auto; width:100%; height:30px; position:relative;  background-color:black">
            <!-- Include page Navigation -->
            <ui:insert name="Navigation">           
                <ui:include src="Navigation.xhtml"/>         
            </ui:insert>
        </div>  
        <div id="logodiv" style="position:relative; top:35px; left:0px;"> 
            <h:graphicImage alt="Account Profile"  style="position:relative"  value="resources/images/logo_account_profile.png" />
        </div>
        <div id="main" style="margin: 0 auto; width:1190px; height:700px; position:absolute;  background-color:transparent; top:105px">

            <div id="mainpage" style="margin: 0 auto; width:1190px; height:500px; position:absolute;  background-color:transparent; top:80px">

                <div id="settingsdiva" style="width:850px; height:500px; position:absolute;  background-color:transparent; top:20px; left:20px">

                    <h:form id="form">
                        <table>
                            <ui:repeat var="ud" value="#{AccountProfileController.userData}">
                                <tr>
                                    <td>User ID</td>
                                    <td>
                                        <h:outputText value="#{ud.userid}" 
                                                      rendered="#{not AccountProfileController.editable}" />
                                        <h:inputText value="#{ud.userid}" rendered="#{AccountProfileController.editable}" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>Group ID</td>
                                    <td>
                                        <h:outputText value="#{ud.groupid}" 
                                                      rendered="#{not AccountProfileController.editable}" />
                                        <h:inputText id="groupid" value="#{ud.groupid}" rendered="#{AccountProfileController.editable}"
                                                     validator="#{ValidatorController.validateEditGroupID}" autocomplete="off">                                        
                                            <f:ajax event="blur" render="groupidvalidator" />                                          
                                        </h:inputText>
                                        <h:message id="groupidvalidator" for="groupid" />
                                    </td>                                    
                                </tr>
                                <tr>
                                    <td>Special Number</td>
                                    <td>
                                        <h:outputText value="#{ud.specialnumber}" 
                                                      rendered="#{not AccountProfileController.editable}" />
                                        <h:inputText value="#{ud.specialnumber}" rendered="#{AccountProfileController.editable}" />
                                    </td>                                    
                                </tr>
                                <tr>
                                    <td>Username</td>
                                    <td>
                                        <h:outputText value="#{ud.username}" 
                                                      rendered="#{not AccountProfileController.editable}" />
                                        <h:inputText value="#{ud.username}" rendered="#{AccountProfileController.editable}" />
                                    </td>                                    
                                </tr>
                                <tr>
                                    <td>Password</td>
                                    <td>
                                        <h:outputText value="Encrypted" 
                                                      rendered="#{not AccountProfileController.editable}" />
                                        <h:inputText value="#{ud.passwd}" rendered="#{AccountProfileController.editable}" />
                                    </td>                                    
                                </tr>
                                <tr>
                                    <td>Date to change password</td>
                                    <td>
                                        <h:outputText value="#{ud.datetochangepasswd}" 
                                                      rendered="#{not AccountProfileController.editable}" />
                                        <h:inputText styleClass="datepicker" value="#{ud.datetochangepasswd}" rendered="#{AccountProfileController.editable}" />
                                    </td>                                    
                                </tr>
                                <tr>
                                    <td>Address</td>
                                    <td>
                                        <h:outputText value="#{ud.address}" 
                                                      rendered="#{not AccountProfileController.editable}" />
                                        <h:inputText value="#{ud.address}" rendered="#{AccountProfileController.editable}" />
                                    </td>                                    
                                </tr>
                                <tr>
                                    <td>State/Region</td>
                                    <td>
                                        <h:outputText value="#{ud.stateregion}" 
                                                      rendered="#{not AccountProfileController.editable}" />
                                        <h:inputText value="#{ud.stateregion}" rendered="#{AccountProfileController.editable}" />
                                    </td>                                    
                                </tr>
                                <tr>
                                    <td>Country</td>
                                    <td>
                                        <h:outputText value="#{ud.country}" 
                                                      rendered="#{not AccountProfileController.editable}" />
                                        <h:inputText value="#{ud.country}" rendered="#{AccountProfileController.editable}" />
                                    </td>                                    
                                </tr>
                                <tr>
                                    <td>User Status</td>
                                    <td>
                                        <h:outputText value="#{ud.userstatus}" 
                                                      rendered="#{not AccountProfileController.editable}" />
                                        <h:inputText value="#{ud.userstatus}" rendered="#{AccountProfileController.editable}" />
                                    </td>                                    
                                </tr>
                                <tr>
                                    <td>Telephone</td>
                                    <td>
                                        <h:outputText value="#{ud.telephone}" 
                                                      rendered="#{not AccountProfileController.editable}" />
                                        <h:inputText value="#{ud.telephone}" rendered="#{AccountProfileController.editable}" />
                                    </td>                                    
                                </tr>
                                <tr>
                                    <td>Date User Added</td>
                                    <td>
                                        <h:outputText value="#{ud.dateuseradded}" 
                                                      rendered="#{not AccountProfileController.editable}" />
                                        <h:inputText styleClass="datepicker" value="#{ud.dateuseradded}" rendered="#{AccountProfileController.editable}" />
                                    </td>                                    
                                </tr>
                                <tr>
                                    <td>User Expire Date</td>
                                    <td>
                                        <h:outputText value="#{ud.userexpiredate}" 
                                                      rendered="#{not AccountProfileController.editable}" />
                                        <h:inputText styleClass="datepicker" value="#{ud.userexpiredate}" rendered="#{AccountProfileController.editable}" />
                                    </td>                                    
                                </tr>
                                <tr>
                                    <td>Date User Locked</td>
                                    <td>
                                        <h:outputText value="#{ud.dateuserlocked}" 
                                                      rendered="#{not AccountProfileController.editable}" />
                                        <h:inputText id="datetouserlocked" styleClass="datepicker" value="#{ud.dateuserlocked}" rendered="#{AccountProfileController.editable}" />
                                    </td>                                    
                                </tr>
                                <tr>
                                    <td>City</td>
                                    <td>
                                        <h:outputText value="#{ud.city}" 
                                                      rendered="#{not AccountProfileController.editable}" />
                                        <h:inputText value="#{ud.city}" rendered="#{AccountProfileController.editable}" />
                                    </td>                                    
                                </tr>
                                <tr>
                                    <td>E-mail</td>
                                    <td>
                                        <h:outputText value="#{ud.email}" 
                                                      rendered="#{not AccountProfileController.editable}" />
                                        <h:inputText value="#{ud.email}" rendered="#{AccountProfileController.editable}" />
                                    </td>                                    
                                </tr>
                                <tr>
                                    <td>Description</td>
                                    <td>
                                        <h:outputText value="#{ud.description}" 
                                                      rendered="#{not AccountProfileController.editable}" />
                                        <h:inputText value="#{ud.description}" rendered="#{AccountProfileController.editable}" />
                                    </td>                                    
                                </tr>

                            </ui:repeat>
                        </table>
                        <!-- Insert this in order to use JGrown message-->                           
                        <p:growl id="growl" showDetail="true" sticky="true" />
                        <h:commandButton value=" Edit Account " rendered="#{not AccountProfileController.editable}" action="#{AccountProfileController.editAccount(true)}" >
                            <f:ajax render="@form" execute="@form"></f:ajax>
                        </h:commandButton>&nbsp;                        
                        <h:commandButton value=" Save Account " rendered="#{AccountProfileController.editable}" action="#{AccountProfileController.saveData}" update="growl">
                            <f:ajax render="@form" execute="@form"></f:ajax>
                        </h:commandButton>&nbsp;
                        <h:commandButton value=" Cancel " rendered="#{AccountProfileController.editable}" action="#{AccountProfileController.initDBData}" >
                            <f:ajax render="@form"></f:ajax>
                        </h:commandButton>

                        <script type="text/javascript">
                            //For calendar
                            $(".datepicker").datepicker({
                                inline: true,
                                showWeek: true,
                                firstDay: 1,
                                dateFormat: 'dd-MM-yy'
                            });                            
                        </script>
                        <script type="text/javascript" src="resources/js/tabs.js"></script> 

                    </h:form>

                </div>   

                <div id="settingsdivb" style="width:450px; height:500px; position:absolute;  background-color:transparent; top:20px; left:600px">

                </div>               

            </div>  
        </div>

    </h:body>
</html>

I tested to remove the AJAX part – the datepicker is working properly. Can you tell me why AJAX prevents the JavaScript to work?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T00:21:29+00:00Added an answer on June 9, 2026 at 12:21 am

    add this (do not replace your current code)

    $(window).load(function () {
     jsf.ajax.addOnEvent(function(data) {
      if (data.status === 'success') {
           $(".datepicker").datepicker({
                inline: true,
                showWeek: true,
                firstDay: 1,
                 dateFormat: 'dd-MM-yy'
            });     
            }
     });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok simple question. I have a JSF application, containing a login page. The problem
I have the following line in a JSF page: <h:commandLink action=#{myBean.test} value=Wizard Step></h:commandLink> I
I have a pretty complex JSF page (we use JSF2 with facelet) in which
I have jsf page: .... <form jsfc=h:form action=> <h:dataTable value=#{newMusician.strings} var=preferredMusicGenre id=musicGenresSelectTable> <h:column> <h:inputText
i have a JSF/Seam Page and added a new not HTML Interface. I reused
I have a JSF page where users can enter their car into my database.
I have a JSF page (using MyFaces 2.0) that does a bit of data
I use Apache Myfaces 2.2 on WebSphere Application Server. I have a JSF page,
I have two dependent dropdowns on a JSF page that work fine. I use
Suppose i have JSF page <h:body> <h:form id=formID prependId=false> <h:outputText id=randomID value=#{randomNumber.random}/> <h:commandButton id=buttonID

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.