PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197

PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
jQuery/Bootstrap Datepicker issue-VBForums
Results 1 to 6 of 6

Thread: jQuery/Bootstrap Datepicker issue

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2008
    Posts
    790

    jQuery/Bootstrap Datepicker issue

    I made a fiddle showing an issue I've been having. When a modal is shown, I am populating a field with a value. On shown, I'm actually querying mysql database and populating fields. The fiddle just shows it being populated with a sample date to show my issue.

    After the modal is shown, when the user clicks on the date field, the filled date doesn't show up in the calendar by default and it will disappear if clicking away from the calendar. It will reappear by clicking on the input again.

    I just want the datepicker to show the selected date of whatever date is filled in the field on modal shown.

    https://jsfiddle.net/michels287/tt9yt8j0/

  2. #2
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    1,948

    Re: jQuery/Bootstrap Datepicker issue

    To pre-select the date on the calendar, use setDate and the date value instead of using Val().

    Sample Logic.
    JavaScript Code:
    1. $('#date-field').datepicker('setDate', '02/12/2016');
    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal |Programming | GitHub
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2008
    Posts
    790

    Re: jQuery/Bootstrap Datepicker issue

    Thanks for helping me.

    The modal form will be filled dynamically. So, how do I set the date if there's a date in the input, otherwise don't set the date and just use datepicker normally?

    I have many datepickers on the form. I am using classes of '.datepicker' for each input.

  4. #4
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    1,948

    Re: jQuery/Bootstrap Datepicker issue

    I just recognized an issue here:

    JavaScript Code:
    1. autoClose: true,

    should be:

    JavaScript Code:
    1. autoclose: true,

    Note: small c does make a difference
    Last edited by KGComputers; Jun 14th, 2016 at 10:04 PM.
    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal |Programming | GitHub
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

  5. #5

    Re: jQuery/Bootstrap Datepicker issue

    Good catch KGcomputers. small c , it worked

  6. #6
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    1,948

    Re: jQuery/Bootstrap Datepicker issue

    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal |Programming | GitHub
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width