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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:26:43+00:00 2026-05-20T09:26:43+00:00

I have an inline calender that is configured to allow multiple date selection. I

  • 0

I have an inline calender that is configured to allow multiple date selection. I want to set number of selectable fields to be set dynamically based on value of a text box. here is my js code

var handle;
    $(function () {
        Date.format = 'yyyy-mm-dd';
        setDatePicker();
    });

    $("#numField").live('click', function () {
        setDatePicker();
    });
    function setDatePicker() {
        //$("#multimonth").destroy();
        handle =  $('#multimonth')
        .datePicker(
            {
                createButton: false,
                inline: true,
                closeOnSelect: false,
                selectMultiple: true,
                numSelectable: $("#numField").val()==""?3:$("#numField").val()
            }
        )
        .bind(
            'click',
            function () {
                $(this).dpDisplay();
                this.blur();
                return false;
            }
        )
        .bind(
            'dateSelected',
            function (e, selectedDate, $td, state, selectedDates) {
                var dotes = $('#multimonth').dpGetSelected();
                for (i = 0; i < dotes.length; i++) {
                    dotes[i] = dotes[i].asString();
                }
                var dates = dotes.join(",");
                alert(dates);
                $("#hiddenDate").val(dates);
            }
        )

    }

I have an input field with id = “numField” and want to change numSelectable parameter of datepicker on change event of my input field. I can’t find any method in its API. thanks in advance

  • 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-20T09:26:44+00:00Added an answer on May 20, 2026 at 9:26 am

    There isn’t anything in the API to change numSelectable but you could add such a thing yourself without that much effort.

    If you look at the source, you’ll see a bunch of dp* functions defined in an object literal:

    dpSetDisabled : function(s)
    {
        //...
    },
    dpSetStartDate : function(d)
    {
        //...
    },
    // ...
    

    So just add this one to the list:

    dpSetNumSelectable: function(n) {
        return _w.call(this, 'setNumSelectable', n);
    }
    

    Then, further down, you’ll see where setStartDate, setEndDate, etc. are defined in another object literal so just add your setNumSelectable definition to that list:

    setNumSelectable: function(n) {
        if(n <= 0) {
            // Sanity checking is left as an exercise for the reader.
        }
        if(this.numSelected > n) {
            // What to do in this case is also left as an exercise for
            // the reader. All the pieces you need to do something sensible
            // here are available and nearby in the source.
        }
        this.numSelectable = n;
    }
    

    Then, you should be able to do this as needed to change the numSelectable option:

    $('#multimonth').dpSetNumSelectable(some_integer);
    

    Don’t be afraid to study and modify the source code of the tools you use, that’s the point of open source software after all. You could even send the author a patch which adds your desired functionality and thus help other people as they helped you (which is another point of open source software).

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

Sidebar

Related Questions

To have a general-purpose documentation system that can extract inline documentation of multiple languages,
Basically I have a set of checkboxes that are dynamically created from view data
I have a inline list of pictures that I want to be able to
I have a class that had an inline member, but I later decided that
The marketing people want to have the ability to write direct inline HTML in
This is a simple question. I want to create an inline calendar that does
I have an inline jquery ui datepicker that has some days disabled, like this
I have a inline select statement to calculate the product of the set of
I have an inline hidden div that I would like to open in a
I have two inline datepickers on my page to select a date range: As

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.