I have a requirement where my business users want to select a date within a dct and have it display in different ways depending on the presentation template.for example:tpl one would display JAN 12, 2012.tpl two would display as January 12, 2012tpl three would display as Wednesday January 12, 2012What is your strategy meeting this type of request from both the dct and tpl perspective?Many thanks.TS 672 sp2 win
Select a format:o YYYY/MM/DD o Month Day Year o etcDate:|________| [imagine a little calendar icon here]
I have a requirement where my business users want to select a date within a dct and have it display in different ways depending on the presentation template.
Do you already have three separate DCTs for some other reason? If not, I wouldn't split them out based on something as simple as a date.I'd go with a calendar dropdown widget like JQuery Datepicker, and use a radio button to select the output format. Something like this: Select a format:o YYYY/MM/DD o Month Day Year o etcDate:|________| [imagine a little calendar icon here] On the other end, I'd offload the formatting to the webservers. If the business ever changes its mind on the way the dates are formatted, having it hardcoded in the output is going to be a pain in your... well, it'll be a pain. You'll have to regenerate everything. Rather, I'd pass the format radio value selected by the user to the front end, and use javascript (or whatever you're using on that end) to format the date.
Methinks you all missed out on the fact that the above requirement implies that the PT controls the date format, not the user. Thus, have a single field in your DCT that *requires* the user to input the date in one easily-parsable specific format of your choice, e.g. yyyy/MM/dd. Then, in your PT, you can use the language's date formatting modules and/or templates to parse the date and output it in whatever format the PT requires. Easiest in PERL, but there are ways in XSL/Java PTs.
...it would be nice to use PERL...