Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Today's Date in the year 2099

Avatar

Level 3

This is a simple question from a newbie that I'm sure some of you pros can figure out in your sleep.  Have a form with a checkbox and date/text field next to the checkbox.  If the box is checked, I would like the text field to display today's date in the year 2099, e.g., 06/16/2099. 

I put this javascript code under the change event of the checkbox, but it doesn't seem to be working.  When I check the box, nothing happens. 

Any ideas?????

var

today = new Date();

var

month = today.getMonth()+1;

var

day = today.getDate();

if

(this.rawValue==1)

{

DateField31.rawValue

= day + "/" + month + "/2099";

{

3 Replies

Avatar

Former Community Member

The last { shoudl be a } ...thats the only thing I see that is wrong.

paul

Avatar

Level 3

See!  You are brilliant!

I am still having an issue however.  I have put this script in the change event of the checkbox b/c there is code that marks the checkbox based on a selection in a droplist.  The goal is:  certain selection in droplist results in checkbox being marked and date being added.  When I make the selection in droplist, it marks the checkbox, but doesn't populate the text field with the date.  If I manually mark the checkbox, the date is added to the text field.

Any suggestions?

Avatar

Level 3

Nevermind - I figured it out.  I just put the date variable and date code in the exit event of the dropdown with the other code so now if I make a certain selection from the drop down, it marks the checkbox AND enters the date.  Cool!

Thanks so much, you have helped me more than you will ever know.