Populate date field using javascript

Written by Paulo Vale on Thursday, November 15, 2007

In some date fields it's useful to have a quick link to populate with, for instance, todays date. See it here.

To accomplish that, first you can attach this javascript code to you page template.

Then you just need to add html code to call the function. The best place to put the code is in my opinion, the "Post element text" region of the field.

Now you can play around changing the date format and adding entries to days, weeks or months.

Related Posts by Categories

Widget by Hoctro | Jack Book
  1. 2 comments: Responses to “ Populate date field using javascript ”

  2. By Anonymous on September 29, 2008 at 12:42 PM

    how would you populate the end date if say you select the start date and then have a duration selection list e.g select 12 months and the end date is auto populated once the 12 months is selected?

  3. By Anonymous on August 11, 2010 at 2:21 AM

    Amiable dispatch and this enter helped me alot in my college assignement. Gratefulness you on your information.