DatePicker with Sheet

The example shows how you can use DateOicker with another applet to select dates. In the example Sheet and DateOicker are displayed side by side. The user selects a cell in Sheet, selects a date from the DatePicker and clicks the insert button. The selected date is inserted into the current Sheet cell.

To run the example click here.

Example code

<script language="JavaScript"><!--

// This function is called when the insert button is clicked.
function insertDate()
{
	var selDate; // Selected date as string
	var selection; // Currently selected Sheet cell
	var ss, dp; // Sheet & DatePicker objects
	
	// Get a reference to Sheet -- it's inside Applet Container
	ss = document.myContainer.findContainedAppletByIndex(0);

	selection = ss.getSelection(); // Get the current cell.

	dp = document.picker;	

	// Build a date string from month, day, and year
	selDate = 	dp.getSelectedMonth() + "/" +
				dp.getSelectedDay() + "/" +
				dp.getSelectedYear();

	// Insert the date into the current cell.
	selection.setCellContentsFromString(selDate);
} // end insertDate() 

// --> </script>

<form> 
<Table cellspacing="15" cellpadding="15">
<tr>
<td>
   <APPLET 	CODEBASE="../.."
   			CODE="lotus.fc.ac.AppletContainer"
			ARCHIVE="jars/devpack_infobus.jar,
					jars/devpack_ic.jar,
					jars/devpack_shared.jar,
					jars/devpack_sheet.jar,
					jars/devpack_scripthelper.jar"
           	WIDTH=640 HEIGHT=350
			NAME="myContainer" >
   <PARAM NAME = "cabinets" VALUE = "cabs/devpack_infobus.cab,
   					cabs/devpack_shared.cab,
					cabs/devpack_ic.cab,
					cabs/devpack_sheet.cab">
   <PARAM NAME = "infoCenterVisible" VALUE = "true">
   <PARAM NAME = "applet0" VALUE = "lotus.sheet.Sheet">
   <PARAM NAME = "name0" VALUE = "sheet">
   </APPLET>
</td>
<td valign="top">
	<Table>
	<tr>
<APPLET codebase="../.."
		CODE="lotus.calendar.datepicker.DatePicker" 
		ARCHIVE="jars\devpack_datepicker.jar"
	Width=186 HEIGHT=180
	NAME="picker">
	<PARAM NAME = "cabinets" VALUE = "cabs/devpack_datepicker.cab">
    <PARAM NAME = "bannervisible" VALUE = "true">
   	<PARAM NAME = "calendarselectorvisible" VALUE = "true">
   	<PARAM NAME = "daymenuvisible" VALUE = "true">
   	<PARAM NAME = "viewselectorvisible" VALUE = "true">
</APPLET>
	</tr>
	<tr><p></tr>
	<tr><td align="center"><input type="button" onclick="insertDate()" value=" Insert Date "></td></tr>
	</table
</td>
</tr>
</table>
</form>