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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:11:36+00:00 2026-05-31T23:11:36+00:00

I have a very simple html page with the following javascript in it $(function()

  • 0

I have a very simple html page with the following javascript in it

$(function() {
    $( "#datepicker" ).datepicker({
        changeMonth: true,
        changeYear: true
    });
    $( "#datepicker" ).datepicker( "option", "dateFormat", "yy-mm-dd" );        
});

Then I have the input target element

<input id="datepicker" type="text" class="boxtpl" name="${field.name}" value="${release?.startDate}">

and I see the html of the input from viewing source is valid…

<input id="datepicker" type="text" class="boxtpl" name="release.startDate" value="2012-02-07">

so when I do the GET request to get this page, my date ONLY renders if I delete that last line in the javascript that sets the format WHICH is very important as that is the format I have playframework configured for!!!!! If I don’t set the format, the POST then breaks because formats don’t match 🙁

Why is setting the format of datepicker clearing out my date????

I can try scripting more to set it manually though I tried calling the api to set it and that DID NOT work so it might not work doing raw javascript set either…not sure yet. anyone know why this occurs or better yet how to fix it???

thanks,
Dean

  • 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-31T23:11:37+00:00Added an answer on May 31, 2026 at 11:11 pm

    Not sure if it’s a bug in jquery ui, but it seems that setting the format effectively deletes the default value. You can fix this with a chained

    .datepicker("setDate", datepicker_default_val );
    

    However, what I did in my web app was define a CSS class “.datepicker” then writing this code snippet provide date pickers to any with that class.

     $( ".datepicker" ).each( function(index){
              var datepicker_default_val = $(this).val();
              $( this ).datepicker({numberOfMonths: 3, showButtonPanel: true});
              $( this ).datepicker( "option", "dateFormat", 'yy-mm-dd' );
              $( this ).datepicker("setDate", datepicker_default_val );
          });
    

    What this does is grabs every element with the tagged class, saves the default value to local var datepicker_default_val, sets the formatting, and then restores the value.

    Little bit of a hack but put that in a $(document).ready(function(){ }); block and you should be good.

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

Sidebar

Related Questions

I have the following, very simple html page: <html> <head> <script type="text/javascript"> function alertSelection()
I have this html page which is very simple, it contains a text box
I have very simple html page with js code: <html> <head> <title></title> </head> <body>
I have a very simple HTML form on a PHP page for a questionnaire.
I have 2 very simple pages, an HTML page and a classic ASP page
I have a very simple html. The red div is inside the blue div
Take a very simple case as an example, say I have this URL: http://www.example.com/65167.html
I have found that my HTML is, to be honest, very clunky. Small, simple
I have some very simple HTML: <div id=advisor> <div id=print_this_container> <form> <input type=button value=
I have the following issue whith this very simple task. I want to create

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.