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)
Old calender cgi.
Bhargav Coca
I am on TS 6.7.1 on Linux, I am revisiting this after a longtime, i have been to several posts but could quite figure out what is needed.
I am trying to use any calender cgi in Workflow (Wft). I have th same fatal error when ever a date is selected. So it is evident ath the problem lies in callback function which gives the value back to DCR/ WFT Instantiator Window, how would i address this back to the window? Here is the snippet for return function.
[html]
function handle_selection()
{
if (callback())
{
opener.top.datacapture.refreshForm();
self.close();
}
else
{
alert('Please make a selection.');
}
}
function callback()
{
var t_hour = dateObj.getHours(); // Returns hours
var t_min = dateObj.getMinutes(); // Returns minutes
if (t_hour>12) {
t_hour = t_hour-12;
var amOrPm = "PM";
}else{
var amOrPm = "AM";
}
if (t_min<10) {
t_min = "0"+t_min;
}
if (t_hour<10) {
t_hour = "0"+t_hour;
}
//document.callout_form_2.dateField.value=document.callout_form_2.dateField.value.replace(/20/,"");
var optionsArray = document.callout_form_2.dateField.value+" "+t_hour+":"+t_min+" "+amOrPm;
if (optionsArray != '')
{
if (!set_datacapture_item_value(optionsArray))
{
alert('Fatal callout error. Did you close the datacapture window?');
}
return true;
}
return false;
}
function set_datacapture_item_value( selectedValue )
{
if ((window.opener == null) ||
(window.opener.closed))
{
return false;
}
var calloutForm = eval($form_name);
if (!calloutForm)
{
return false;
}
var calloutElementFound = false;
for ( i = 0 ; i < calloutForm.elements.length ; i++ )
{
if (calloutForm.elements
.name == '$element_name')
{
calloutForm.elements
.value = selectedValue;
calloutElementFound = true;
break;
}
}
if (!calloutElementFound)
{
return false;
}
return true;
}
//Form button calendar
//author unknown
function setDate(obj) {
var str;
if (obj.disabled == true) {
return;
} else {
str = obj.value;
}
if (str == " ")
{
alert("invalid selection");
return;
}
mnth1 = document.forms[0].month.value;
mnth = mnth1;
mnth++;
year = document.forms[0].year.value;
var mnth_print= mnth;
if (mnth < 10) { mnth_print= "0"+mnth;}
var day_print= str;
if (str < 10) { day_print= "0"+str;}
year = year.substr(year.length-2,year.length);
dateStr = mnth_print+"/"+day_print+"/"+year;
dateStr = trim(dateStr);
document.forms[1].dateField.value = dateStr;
handle_selection(); //this function must be include in the html page (get it from teamsite)
}
[/html]
Thank You
Find more posts tagged with
Comments
Adam Stoller
Functions like
set_datacapture_item_value
are a pretty good indicator that the code is written for DCTs and not for WFTs.
Because the WF instantiator takes over the responsibility of defining the form entry fields you would have to parse through the form to find the fields by name (rather than id) and first you have to make sure that you have the handle on the correct form.
I don't recall the mechanics off the top-of-my-head, but it shouldn't be too difficult to play around with the code in a decent browser (like Firefox with firebug) to figure out what you need to do.