Copy link to clipboard
Copied
I'm trying to add 2 calculated dates to a drop down for the release date on a form I am currently working on. I can get the 1st one in there but not the 2nd. In the "Options" tab I only have "Permanent" listed. In the "Calculate" tab I have the following custom calculation script:
(function () {
// Get date from field
var v = getField("Today").value;
if (v) {
// Convert string to date
var d = util.scand('mm/dd/yyyy', v);
// Add 14 days
d.setDate(d.getDate() + 14);
// Set value of this field to the new date
event.value = util.printd("mm/dd/yyyy", d);
} else {
// Blank field if no date entered
event.value = "";
}
})();(function () {
// Get date from field
var v = getField("Today").value;
if (v) {
// Convert string to date
var d = util.scand('mm/dd/yyyy', v);
// Add 180 days
d.setDate(d.getDate() + 14);
// Set value of this field to the new date
event.value = util.printd("mm/dd/yyyy", d);
} else {
// Blank field if no date entered
event.value = "";
}
})();
The Release Date dropdown would show the following date options:
- “Today’s Date” + 14 days
- “Today’s Date” + 180 days
- Permanent
Copy link to clipboard
Copied
Your script needs to check the dropdown's value to determine the number of days to add. You might also want to add some code to ensure the user has selected a number of days.
I am not sure why you need to post multiple questions about this issue.
Copy link to clipboard
Copied
I'm new to this so my apologies for posting multiple questions about this issue. I wasn't sure if I had posted the 1st one correctly.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now