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 6876785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:31:15+00:00 2026-05-27T04:31:15+00:00

I have a search form on which I have the following INPUT field <input

  • 0

I have a search form on which I have the following INPUT field

  <input id="pickUpDate" name="pickUpDate" readonly="true" />

When this search form is accessed I can see the date picker attached to the input#pickUpDate element when I click on it.

I submit this search form using DWR by invoking the search(…) function (shown below).

I reset the HTML body element’s data with the response I receive.
In the response received, I have a similar search form which contains the same input element (input#pickUpDate).However after I reset the body element’s data
using

    $("body").html(data);

in the DWR callback function and try to attach datepicker it does not work.I inspected that the element is appended the datepicker’s “hasDatepicker”
marker class name but still on focusing/clicking on the input field I cannot see the datepicker.

Following is my jQuery code :

 (function($){

    enableDatePicker = function(elementSelector) {

        var datePickerInitialisationOptions = {
                numberOfMonths : 3,
                buttonImage : "resources/images/calendar.gif",
                buttonImageOnly : true,
                showOn : 'both',
                closeText : 'Close',
                showButtonPanel : true
            };

        $(elementSelector).datepicker(datePickerInitialisationOptions); 

    };

    // Makes a DWR call
    search = function(..function_params...) {

        AsyncService.getSearchResults(
                ...function_params..., {

            callback: function(data) {

                $("body").html(data);

                $('#pickUpDate').datepicker();

            },

            errorHandler: function(message) {
                alert("Oops: " + message);
            }
        });
    };

}) (jQuery);

$(document).ready(function() {

    $("#id_search-submit").click(function(){        

            ....params...

            search(params);

    });

    enableDatePicker("#pickUpDate"); // This works fine.That is the date picker is shown on initial access of search form when clicking on the INPUT element having id 'pickUpDate';
});

I have gone through all the relevant posts I could find regarding this but the solutions mentioned in them didn’t worked for me.

I am in need to know what is the causing the mentioned problem and how to get this resolved?

Thanks,
Jignesh

  • 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-05-27T04:31:16+00:00Added an answer on May 27, 2026 at 4:31 am

    I have got this resolved.And posting my solution here for reference:

    // Makes a DWR call
    search = function(..function_params...) {
    
        AsyncService.getSearchResults(
                ...function_params..., {
    
            callback: function(data) {
    
                $("body").html(data);
    
    
        $.datepicker.initialized = false; // This resolved the problem
                $('#pickUpDate').datepicker();
    
            },
    
            errorHandler: function(message) {
                alert("Oops: " + message);
            }
        });
    };
    

    As per what I understood this is the explanation behind what was causing the problem

    Before the AJAX call it’s value was was set to true by the following block in source code of jquery.ui.datepicker.js (this block can be found near the end of the file)

    Code:

    /* Initialise the date picker. */
    if (!$.datepicker.initialized) {
        $(document).mousedown($.datepicker._checkExternalClick).
        find('body').append($.datepicker.dpDiv);
        $.datepicker.initialized = true;
    }
    

    Since the $.datepicker.initialized value was always found “true” after the HTML was updated on the page by DWR, the presentation div referred to by $.datepicker.dpDiv in jquery.ui.datepicker.js source code was not getting appended to the tag when datepicker() was invoked on an element which was causing the datepicker for not getting displayed though the marker class ‘hasDatepicker‘ was getting applied.

    Thanks,
    Jignesh

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following HTML: <form id=test> <input type=radio value=A name=C1/> <a href=javascript:selectCheckbox('C1', 'A');>
I have a search form used to query service provisions, which I will call
I have a really simple search form with the following Label (Search) Textbox (fixed
I have the following code: $(#auto).autocomplete({ source: js/search.php, minLength: 3 }); This code is
I have the following method public ActionResult Search(FormCollection form) { ....... Publication[] publicationsResult =
On a page I have a google search-field and a separate form for a
On my page I have a search form which generates a table for the
I have a search form with a query builder. The builder is activated by
I have a search form in an app I'm currently developing, and I would
I have a search form on each of my pages. If I use form

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.