onclick event in cfscript?
I have been through this discussion list and another and cannot find an answer to my problem. I'm hoping someone can help.
I am wanting to use a calendar script I found (WriteCalendar at www.cflib.org/udf.cfm?id=540) that is written in cfscript.
<cfscript>
/**
* Produces a Calendar for a given month and year.
*
* @9397041 curMonth The month to display.
* @9397041 curYear The year to display.
* @9397041 height Height of the table cells. Defaults to 40.
* @9397041 width Width of the table cells. Defaults to 60.
* @9397041 titleStyle Style to apply to title row.
* @9397041 numberStyle Style to apply to days of the month.
* @Return Returns a string.
* @7111211 William Steiner (williams@hkusa.com)
* @version 1, April 12, 2002
*/
function createCalendar(curMonth,curYear) {
var outString = "";
var firstDay = CreateDate(curYear, curMonth, 1);
var firstDayDigit = DayOfWeek(FirstDay);
var i = 1;
var h = 1;
var height = 40;
var width = 60;
var titleStyle = "";
var numberStyle = "";
if(arrayLen(arguments) gte 3) height = arguments[3];
if(arrayLen(arguments) gte 4) width = arguments[4];
if(arrayLen(arguments) gte 5) titleStyle = arguments[5];
if(arrayLen(arguments) gte 6) numberStyle = arguments[6];
outString = "<table border='1'><tr><td align=center colspan='7' ";
if(len(titleStyle)) outString = outString & "class='#titleStyle#'";
outString = outString & ">#DateFormat(firstDay, 'mmmm')#</td></tr>";
// if it isn't sunday, then we need to if space over to start on the corrent day of week
if (firstDayDigit neq 1) {
for (h=1; h lt DayOfWeek(FirstDay); h = h+1) {
outString = outString & "<td> </td>";
}
}
// loop thru all the dates in this month
for (i=1; i lte DaysInMonth(firstDay); i = i+1) {
//is it Sunday? if so start new row.
if (DayOfWeek(CreateDate(curYear, curMonth, i)) eq 1) {
outString = outString & "<tr>";
}
// insert a day
outString = outString & "<td align='left' valign='top' width='#width#px' ";
if(len(numberStyle)) outString = outString & "class='#numberStyle#' ";
outString = outString & "height='#height#'>#i#<br></td> ";
// is it the last day of the month? if so, fill row with blanks.
if (i eq DaysInMonth(firstDay)) {
for (h=1; h lte (7-DayOfWeek(CreateDate(curYear, curMonth, i))); h = h+1) {
outString = outString & "<td> </td>";
}
}
if (DayOfWeek(CreateDate(curYear, curMonth, i)) eq 7){
outString = outString & "</tr>";
}
}
outString=outString & "</table>";
return outString;
}
</cfscript>
For the line outString = outString & "height='#height#'>#i#<br></td> ";, I would like to modifly that to allow a user to click on the day and have that date be sent to a form field called selectedDate. This can the be submitted and used to create a room schedule table.
I know in javascript I can set an onclick that will then populate a form value. Is there an equivalent in cfscript? I have looked here and everyone notes that I cannot use javascript within cfscript.
Is this one where it cannot be done? I hope it can. Any help is greatly appreciated.
Thank you!
Lynn
