By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,745 Members | 1,897 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,745 IT Pros & Developers. It's quick & easy.

Wizard Control & Pop-up return value

P: n/a
Dear Experts,

I am having a wizard control in my web app. I have some textbox controls
within the wizard control. At the same time, I have a hyperlink to run a
pop-up window for calendar. The pop-up window is executed by calling a
javascript function. However, when I click on the calendar link for the
pop-up, I received an error message stating : Microsoft JScript runtime
error: Object required

When I use the same script in another webform, without wizard control I do
not have such a problem. I am wondering is there something wrong with my code
or the javascript:

function NewCal(pCtrl,pFormat,pShowTime,pTimeMode)
{
Cal=new Calendar(dtToday);
if ((pShowTime!=null) && (pShowTime))
{
Cal.ShowTime=true;
if ((pTimeMode!=null) &&((pTimeMode=='12')||(pTimeMode=='24')))
{
TimeMode=pTimeMode;
}
}
if (pCtrl!=null)
Cal.Ctrl=pCtrl;
if (pFormat!=null)
Cal.Format=pFormat.toUpperCase();

exDateTime=document.getElementById(pCtrl).value;
if (exDateTime!="")//Parse Date String
{
var Sp1;//Index of Date Separator 1
var Sp2;//Index of Date Separator 2
var tSp1;//Index of Time Separator 1
var tSp1;//Index of Time Separator 2
var strMonth;
var strDate;
var strYear;
var intMonth;
var YearPattern;
var strHour;
var strMinute;
var strSecond;
//parse month
Sp1=exDateTime.indexOf(DateSeparator,0)
Sp2=exDateTime.indexOf(DateSeparator,(parseInt(Sp1 )+1));

if ((Cal.Format.toUpperCase()=="DDMMYYYY") ||
(Cal.Format.toUpperCase()=="DDMMMYYYY"))
{
strMonth=exDateTime.substring(Sp1+1,Sp2);
strDate=exDateTime.substring(0,Sp1);
}
else if ((Cal.Format.toUpperCase()=="MMDDYYYY") ||
(Cal.Format.toUpperCase()=="MMMDDYYYY"))
{
strMonth=exDateTime.substring(0,Sp1);
strDate=exDateTime.substring(Sp1+1,Sp2);
}
if (isNaN(strMonth))
intMonth=Cal.GetMonthIndex(strMonth);
else
intMonth=parseInt(strMonth,10)-1;
if ((parseInt(intMonth,10)>=0) && (parseInt(intMonth,10)<12))
Cal.Month=intMonth;
//end parse month
//parse Date
if ((parseInt(strDate,10)<=Cal.GetMonDays()) && (parseInt(strDate,10)>=1))
Cal.Date=strDate;
//end parse Date
//parse year
strYear=exDateTime.substring(Sp2+1,Sp2+5);
YearPattern=/^\d{4}$/;
if (YearPattern.test(strYear))
Cal.Year=parseInt(strYear,10);
//end parse year
//parse time
if (Cal.ShowTime==true)
{
tSp1=exDateTime.indexOf(":",0)
tSp2=exDateTime.indexOf(":",(parseInt(tSp1)+1));
strHour=exDateTime.substring(tSp1,(tSp1)-2);
Cal.SetHour(strHour);
strMinute=exDateTime.substring(tSp1+1,tSp2);
Cal.SetMinute(strMinute);
strSecond=exDateTime.substring(tSp2+1,tSp2+3);
Cal.SetSecond(strSecond);
}
}
winCal=window.open("","DateTimePicker","toolbar=0, status=0,menubar=0,fullscreen=no,width=195,height= 245,resizable=0,top="+cnTop+",left="+cnLeft);
docCal=winCal.document;
RenderCal();
}

Webform:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="ITRequest.aspx.vb"
Inherits="_Default" %>
<%@ Import Namespace="Commons" %>
<%@ Assembly Src="CommonFunctions.vb" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<script language="javascript" type="text/javascript" src="datetimepicker.js">

//Date Time Picker script- by TengYong Ng of http://www.rainforestnet.com
//Script featured on JavaScript Kit (http://www.javascriptkit.com)
//For this script, visit http://www.javascriptkit.com

</script>
<title>IT Request Form</title>
</head>
<body>
<form id="frmITRequest" runat="server" method="Post"
enctype="multipart/form-data">
<div>
<h1 style="text-align: center">
Online
IT Request Form</h1>
<p>
<Table>
<tr>
<td >
<asp:Label ID="lblReqNo" runat="server"
Text="Request No.:" Visible="False"></asp:Label></td>
<td colspan="3">
<asp:TextBox ID="txtReqNo" runat="server"
BackColor="White" CausesValidation="True" ReadOnly="True" AutoPostBack="True"
style="color: red" Visible="False"></asp:TextBox></td>
</tr>
<tr>
<td >
Requested Date Time:</td>
<td >
<asp:TextBox ID="txtReqDateTime" runat="server"
style="color: black" BackColor="#E0E0E0" Font-Names="Arial" ReadOnly="True"
Height="18px" ></asp:TextBox></td>
<td >
Required Date:</td>
<td >

<asp:TextBox ID="txtRequireDateTime" runat="server"
Width="150px" AutoPostBack="True" ></asp:TextBox>
<asp:HyperLink ID="hlRequiredDateCal" runat="server"
Font-Size="Small" Style="position: static"
NavigateUrl="javascript:NewCal('txtRequireDateTime ','ddmmmyyyy',true,24)">Calendar</asp:HyperLink></td>
</tr>
Portion of the code is enclosed. Please help.

Regards,
SB
Mar 20 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.