I really need a pros help here

G

Guest

Hi,
I have been trying for days, yes days, to use the calender from the asp.net
timetracker starter kit. I am now frustrated. I finally get the popup
calender to popup but when I click ok to insert the date to the calling page
I get the error


"A runtime error has occured

Line 14

Error: 'popUp is null or not an object'


This is the code for the page that is calling the popup. (on page load)

btnDateFrom.Attributes("onclick") =
"javascript:OpenCalendar('txtFrom',true)"

This is in the <HEAD> section of that page



<script language="javascript" src="script.js" type="text/javascript"></script>


This is the script.js



var popUp; <-----------------------note popUp here

function OpenCalendar(idname, postBack)
{
popUp = window.open('Calender.aspx?formname=' + document.forms[0].name +
'&id=' + idname + '&selected=' + document.forms[0].elements[idname].value
+ '&postBack=' + postBack,
'popupcal',
'width=270,height=260,left=200,top=250');
}

function SetDate(formName, id, newDate, postBack)
{
eval('var theform = document.' + formName + ';');
popUp.close();
theform.elements[id].value = newDate;
if (postBack)
__doPostBack(id,'');
}



This is the code for the OK button on the calender page on page load



Dim selected As String = Request.QueryString("selected")
Dim id As String = Request.QueryString("id")
Dim form As String = Request.QueryString("formname")
Dim postBack As String = Request.QueryString("postBack")

btnOk.Attributes.Add("onClick", "window.opener.SetDate('" + form + "','" +
id + "', document.Calender.datechosen.value," + postBack + ");")


Help please! The Calender popups up fine all I need now is to pass the
select data back to the main form.

Thanks
 
K

Kumar Reddi

Well, which is the line 14

--
Kumar Reddi
http://kumarreddi.blogspot.com

Chris said:
Hi,
I have been trying for days, yes days, to use the calender from the asp.net
timetracker starter kit. I am now frustrated. I finally get the popup
calender to popup but when I click ok to insert the date to the calling page
I get the error


"A runtime error has occured

Line 14

Error: 'popUp is null or not an object'


This is the code for the page that is calling the popup. (on page load)

btnDateFrom.Attributes("onclick") =
"javascript:OpenCalendar('txtFrom',true)"

This is in the <HEAD> section of that page



<script language="javascript" src="script.js"
type="text/javascript"> said:
This is the script.js



var popUp; <-----------------------note popUp here

function OpenCalendar(idname, postBack)
{
popUp = window.open('Calender.aspx?formname=' + document.forms[0].name +
'&id=' + idname + '&selected=' + document.forms[0].elements[idname].value
+ '&postBack=' + postBack,
'popupcal',
'width=270,height=260,left=200,top=250');
}

function SetDate(formName, id, newDate, postBack)
{
eval('var theform = document.' + formName + ';');
popUp.close();
theform.elements[id].value = newDate;
if (postBack)
__doPostBack(id,'');
}



This is the code for the OK button on the calender page on page load



Dim selected As String = Request.QueryString("selected")
Dim id As String = Request.QueryString("id")
Dim form As String = Request.QueryString("formname")
Dim postBack As String = Request.QueryString("postBack")

btnOk.Attributes.Add("onClick", "window.opener.SetDate('" + form + "','" +
id + "', document.Calender.datechosen.value," + postBack + ");")


Help please! The Calender popups up fine all I need now is to pass the
select data back to the main form.

Thanks
 
G

Guest

I would think it's the popup variable in the javascript

Kumar Reddi said:
Well, which is the line 14

--
Kumar Reddi
http://kumarreddi.blogspot.com

Chris said:
Hi,
I have been trying for days, yes days, to use the calender from the asp.net
timetracker starter kit. I am now frustrated. I finally get the popup
calender to popup but when I click ok to insert the date to the calling page
I get the error


"A runtime error has occured

Line 14

Error: 'popUp is null or not an object'


This is the code for the page that is calling the popup. (on page load)

btnDateFrom.Attributes("onclick") =
"javascript:OpenCalendar('txtFrom',true)"

This is in the <HEAD> section of that page



<script language="javascript" src="script.js"
type="text/javascript"> said:
This is the script.js



var popUp; <-----------------------note popUp here

function OpenCalendar(idname, postBack)
{
popUp = window.open('Calender.aspx?formname=' + document.forms[0].name +
'&id=' + idname + '&selected=' + document.forms[0].elements[idname].value
+ '&postBack=' + postBack,
'popupcal',
'width=270,height=260,left=200,top=250');
}

function SetDate(formName, id, newDate, postBack)
{
eval('var theform = document.' + formName + ';');
popUp.close();
theform.elements[id].value = newDate;
if (postBack)
__doPostBack(id,'');
}



This is the code for the OK button on the calender page on page load



Dim selected As String = Request.QueryString("selected")
Dim id As String = Request.QueryString("id")
Dim form As String = Request.QueryString("formname")
Dim postBack As String = Request.QueryString("postBack")

btnOk.Attributes.Add("onClick", "window.opener.SetDate('" + form + "','" +
id + "', document.Calender.datechosen.value," + postBack + ");")


Help please! The Calender popups up fine all I need now is to pass the
select data back to the main form.

Thanks
 
K

Kumar Reddi

I know sir. But popup variable is at multiple places. So, it helps to see
which line that is causing error.
--
Kumar Reddi
http://kumarreddi.blogspot.com

Chris said:
I would think it's the popup variable in the javascript

Kumar Reddi said:
Well, which is the line 14

--
Kumar Reddi
http://kumarreddi.blogspot.com

Chris said:
Hi,
I have been trying for days, yes days, to use the calender from the asp.net
timetracker starter kit. I am now frustrated. I finally get the popup
calender to popup but when I click ok to insert the date to the
calling
page
I get the error


"A runtime error has occured

Line 14

Error: 'popUp is null or not an object'


This is the code for the page that is calling the popup. (on page load)

btnDateFrom.Attributes("onclick") =
"javascript:OpenCalendar('txtFrom',true)"

This is in the <HEAD> section of that page



<script language="javascript" src="script.js"
type="text/javascript"> said:
This is the script.js



var popUp; <-----------------------note popUp here

function OpenCalendar(idname, postBack)
{
popUp = window.open('Calender.aspx?formname=' + document.forms[0].name +
'&id=' + idname + '&selected=' + document.forms[0].elements[idname].value
+ '&postBack=' + postBack,
'popupcal',
'width=270,height=260,left=200,top=250');
}

function SetDate(formName, id, newDate, postBack)
{
eval('var theform = document.' + formName + ';');
popUp.close();
theform.elements[id].value = newDate;
if (postBack)
__doPostBack(id,'');
}



This is the code for the OK button on the calender page on page load



Dim selected As String = Request.QueryString("selected")
Dim id As String = Request.QueryString("id")
Dim form As String = Request.QueryString("formname")
Dim postBack As String = Request.QueryString("postBack")

btnOk.Attributes.Add("onClick", "window.opener.SetDate('" + form +
"','"
+
id + "', document.Calender.datechosen.value," + postBack + ");")


Help please! The Calender popups up fine all I need now is to pass the
select data back to the main form.

Thanks
 
B

bruce barker

my guess would be that the button that opens the pop is doing a postback,
thus the var popUp is set back to undefined. you could move the close to the
popup window itself - makes more sense.

btnOk.Attributes.Add("onClick",
"window.opener.SetDate('" + form + "','" +
id + "', document.Calender.datechosen.value," + postBack +
");window.close();"
)

though on the main page you should close the popup on window unload, so as
not to leave a dangling popup window;

-- bruce (sqlwork.com)


| Hi,
| I have been trying for days, yes days, to use the calender from the
asp.net
| timetracker starter kit. I am now frustrated. I finally get the popup
| calender to popup but when I click ok to insert the date to the calling
page
| I get the error
|
|
| "A runtime error has occured
|
| Line 14
|
| Error: 'popUp is null or not an object'
|
|
| This is the code for the page that is calling the popup. (on page load)
|
| btnDateFrom.Attributes("onclick") =
| "javascript:OpenCalendar('txtFrom',true)"
|
| This is in the <HEAD> section of that page
|
|
|
| <script language="javascript" src="script.js"
type="text/javascript"></script>
|
|
| This is the script.js
|
|
|
| var popUp; <-----------------------note popUp here
|
| function OpenCalendar(idname, postBack)
| {
| popUp = window.open('Calender.aspx?formname=' + document.forms[0].name +
| '&id=' + idname + '&selected=' + document.forms[0].elements[idname].value
| + '&postBack=' + postBack,
| 'popupcal',
| 'width=270,height=260,left=200,top=250');
| }
|
| function SetDate(formName, id, newDate, postBack)
| {
| eval('var theform = document.' + formName + ';');
| popUp.close();
| theform.elements[id].value = newDate;
| if (postBack)
| __doPostBack(id,'');
| }
|
|
|
| This is the code for the OK button on the calender page on page load
|
|
|
| Dim selected As String = Request.QueryString("selected")
| Dim id As String = Request.QueryString("id")
| Dim form As String = Request.QueryString("formname")
| Dim postBack As String = Request.QueryString("postBack")
|
| btnOk.Attributes.Add("onClick", "window.opener.SetDate('" + form + "','"
+
| id + "', document.Calender.datechosen.value," + postBack + ");")
|
|
| Help please! The Calender popups up fine all I need now is to pass the
| select data back to the main form.
|
| Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top