Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
automatically generated expiration date?
System
Hello all,
i am currently using z_calendar.ipl to allow users to pick publish dates in our DCTs. however. instead of them having to open the callout again for the exp date, i would like to automatically populate a text field with an expiration date based on what they selected for the publish date.
for example, press releases on our site need to expire on december 31st - 4 years from the date selected.
so if they picked todays date (01-20-2004), i would like to automatically set the expiration date to 12-31-2008 in a text field below. i tried using the formapi with onitemchange, but had no luck. thanks in advance!
---------------------
Eric B.
Federated Investors
AOL IM: arthas76
Find more posts tagged with
Comments
JonathonG
Why not change z_calendar.ipl to write the expiration date at the same time as the publish date? You should have access to the entire datacapture form from your callout.
Jonathon
Independent Interwoven Contractor
jwl
Hi Eric
I'm doing something effectively identical to what you described, and encountering the same problem with FormAPI not reacting to a calendar entry - onItemChange only seems to react to a keyboard event. Just wondering how you eventually resolved this problem.
thanks
Migrateduser
jwl the onItemChange event should work with the mouse when you click on another field to change the focus.
but i got the expiration date to work by using an inline call to a perl script w/ this code which adds 4 years to the sysdate:
#!c:\iw-home/iw-perl/bin/iwperl
use Time::Local;
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =localtime(time);
$mon_text = (qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec))[$mon];
$year = $year + 1904;
$formatted_date = "12-31-$year";
$XML_HEADER="<?xml version='1.0' encoding='UTF-8'?><substitution><default>";
$XML_FOOTER="</default></substitution>";
##################### Call the main Subroutine ####################
&main();
########################## Main Subroutine ########################
# this is the entry point of the program, it calls the other two
# subroutines
sub main{
print "$XML_HEADER";
print "$formatted_date";
print "$XML_FOOTER";
return 0;
}
---------------------
Eric B.
Federated Investors
AOL IM: arthas76