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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:56:48+00:00 2026-06-06T18:56:48+00:00

I have a simple form for generating reports that I am adding a jqueryUI

  • 0

I have a simple form for generating reports that I am adding a jqueryUI datepicker to. The problem I am having is when I try to repopulate the fields with the info from the user.

Jquery seems to be resetting the default value on my date fields (currently, it picks 2 different dates in July). How can I set it back to the user submitted value?

My current code:

<form method="post" action="">
        Username: <input type="text" size="12" name="username" required  value="foo" />
        Password: <input type="password" size="12" name="password" required value="bar" />
        Start Date: <input id="startdate" type="text" size="12" name="startday" required  value="06/28/2012" />
        End Date: <input id="enddate" type="text" size="12" name="endday" required  value="06/30/2012" />

        <script type="text/javascript">
            $(function(){
                $("#startdate").datepicker();
                $("#enddate").datepicker();
            });
        </script>
        <input type="submit">
    </form>
  • 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-06T18:56:50+00:00Added an answer on June 6, 2026 at 6:56 pm

    Set the date to highlight on first opening if the field is blank. Specify either an actual date via a Date object or as a string in the current dateFormat, or a number of days from today (e.g. +7) or a string of values and periods (‘y’ for years, ‘m’ for months, ‘w’ for weeks, ‘d’ for days, e.g. ‘+1m +7d’), or null for today.

    Initialize a datepicker with the defaultDate option specified.

    $( ".selector" ).datepicker({ defaultDate: +7 });
    

    Get or set the defaultDate option, after init.

    //getter
    var defaultDate = $( ".selector" ).datepicker( "option", "defaultDate" );
    
    //setter
    $( ".selector" ).datepicker( "option", "defaultDate", +7 );
    

    http://jqueryui.com/demos/datepicker/#option-defaultDate

    Fiddle:
    http://jsfiddle.net/iambriansreed/gMNrZ/

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

Sidebar

Related Questions

Have a simple form (only extract fields here) but for some reason the JQserilization
I have a simple form that looks like this: <%= simple_form_for @study,:url => studies_path,
I have a simple form that looks like so <% remote_form_for post, :url =>
I have a simple content edit form (Zend_Form) that I populate() with an array
I have a form that I am trying to add a simple select element
I have a simple form in my MVC3 site that allows users to create
I have simple form. <form target=_blank action=somescript.php method=Post id=simpleForm> <input type=hidden name=url value=http://...> <input
I have simple form like this which accepts only two values string action and
I have this simple form which shows a pop up calendar when clicked on
I have a simple form like this : <form method=post name=change_pass id=change_pass action=change_pass2.php> <input

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.