Aleks,
I would start very simple with this: create a basic html file with just some plain text under httpd/iw/custom/simple.html and then try this in a browser: http:///iw/custom/simple.html. Does that show something?
Also, to make life simple for you, use a old-fashoined 'callout'-element in your dcr in favor over creating it in formapi. It that works and you REALLY need to do it via formapi you always still can.
If you still need help after this be sure to put more detail in your question, like: what does the popup window show, like 404? What do the logs say? Version? Os?
Hope this helps
Hi,I am posting the required portion of the DCT here:Step 1: I referred the calendar_init.js and my custom JS in DCT. My custom JS is having the event handlers<script language="javascript" location="webserver" src="/iw-mount/.../js/Metadata_CheckBox.js"/><script src="/iw-cc/base/widget/calendar/calendar_init.js" language="javascript" type="text/javascript"/> Step 2: I have a date type item and a callout button <item name="ExpireDate" pathid="ExpireDate" rowcontinue="t"> <label>Expiry Date</label> <description>Expiration date for articles <text required="f" maxlength="10" size="32"> <cgi-callout label="Select Date"/> </text></item><item name="resetOutputButton_ExpireDate" pathid="resetOutputButton_ExpireDate"> <label></label> <radio> <cgi-callout label="Reset"/> </radio></item> Step 3: The callout button event handler invokes the method in calender_init.js/*--------------------Event Handlers--------------------*/IWEventRegistry.addItemHandler("/KMS_metadata/KMS_Metadata/ExpireDate", "onCallout", calendar);IWEventRegistry.addItemHandler('/KMS_metadata/KMS_Metadata/resetOutputButton_ExpireDate', 'onCallout', resetOutputButton_ExpireDate); /*--------------------Functions--------------------*/function calendar(item) { function DateCallBack(date) {item.setValue(formatDate(date, "yyyy-MM-dd"));} var theCalendarWindow = fwShowCalendar("-callback", DateCallBack, "-initialdate", new Date().valueOf());}function resetOutputButton_ExpireDate(item) { var targetItem = IWDatacapture.getItem('/KMS_metadata/KMS_Metadata/ExpireDate'); if (targetItem) { targetItem.setValue(""); }}
<script language="javascript" location="webserver" src="/iw-mount/.../js/Metadata_CheckBox.js"/><script src="/iw-cc/base/widget/calendar/calendar_init.js" language="javascript" type="text/javascript"/>
<item name="ExpireDate" pathid="ExpireDate" rowcontinue="t"> <label>Expiry Date</label> <description>Expiration date for articles <text required="f" maxlength="10" size="32"> <cgi-callout label="Select Date"/> </text></item><item name="resetOutputButton_ExpireDate" pathid="resetOutputButton_ExpireDate"> <label></label> <radio> <cgi-callout label="Reset"/> </radio></item>
/*--------------------Event Handlers--------------------*/IWEventRegistry.addItemHandler("/KMS_metadata/KMS_Metadata/ExpireDate", "onCallout", calendar);IWEventRegistry.addItemHandler('/KMS_metadata/KMS_Metadata/resetOutputButton_ExpireDate', 'onCallout', resetOutputButton_ExpireDate); /*--------------------Functions--------------------*/function calendar(item) { function DateCallBack(date) {item.setValue(formatDate(date, "yyyy-MM-dd"));} var theCalendarWindow = fwShowCalendar("-callback", DateCallBack, "-initialdate", new Date().valueOf());}function resetOutputButton_ExpireDate(item) { var targetItem = IWDatacapture.getItem('/KMS_metadata/KMS_Metadata/ExpireDate'); if (targetItem) { targetItem.setValue(""); }}
formatDate(date, "yyyy-MM-dd") function is not returning anything.
Any pointer on this?
Do you even have a function called formatDate ? FInd it and then debug
Actually, ignore my previous post, you likely did not include the right JS:
<script src="/iw-cc/base/widget/calendar/calendar_init.js" language="javascript" type="text/javascript"/>
This should be in one of your 1st definitions.
Thanks for swift response!
I have below in the DCT
<script language="javascript" src="/iw/js/personalization/personalization.js"/> <script language="javascript" src="/iw/js/personalization/repdelete.js"/> <script language="javascript" src="/iw/js/personalization/logictemplate.js"/> <script language="javascript" src="/iw-cc/base/widget/calendar/calendar_init.js" type="text/javascript"/>
in js
IWEventRegistry.addItemHandler("/personalization_root_container/personalization_container/ExpireDate", "onCallout", calendar);
function calendar(item) { function DateCallBack(date) {item.setValue(formatDate(date, "MM-dd-yyyy"));} theCalendarWindow = fwShowCalendar("-callback", DateCallBack, "-initialdate", new Date().valueOf()); }
Thanks!
The below change has fix the issue.
function calendar(item) { function DateCallBack(date) { var formattedDate = date.getMonth()+1 + '/' + date.getDate() + '/' + date.getFullYear(); item.setValue(formattedDate); } theCalendarWindow = fwShowCalendar("-callback", DateCallBack, "-initialdate", new Date().valueOf());
Hi,
i need date format in this way: "Sat. Apr. 18". I tried for month in JS as below and calendar is not working. Please suggest ways
function calendar(item) {
function DateCallBack(date) {
//var month = month[date.getMonth()].substr(0,3);
var formattedDate = month[date.getMonth()].substr(0,3)+1 + '.' + date.getDate() + '.' + date.getFullYear(); item.setValue(formattedDate);
}
theCalendarWindow = fwShowCalendar("-callback", DateCallBack, "-initialdate", new Date().valueOf()); }
Suggestions would be appreciated.
Why don't you do some debugging?
If that was my code, I would use an alert to see the original informantion and also post what you are getting ,
You could also just take a moment to look at your code.. Pretty sure adding 1 to a three-letter month string is not what you intended.
Please debug your JS. Break the below and get the alert for each and every value. By doing this you can find where is the issue.
var formattedDate = month[date.getMonth()].substr(0,3)+1 + '.' + date.getDate() + '.' + date.getFullYear();