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

I really need a pros help here

P: n/a
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
Nov 19 '05 #1
Share this Question
Share on Google+
5 Replies

P: n/a
Well, which is the line 14

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

"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:2A**********************************@microsof t.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

Nov 19 '05 #2

P: n/a
I would think it's the popup variable in the javascript

"Kumar Reddi" wrote:
Well, which is the line 14

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

"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:2A**********************************@microsof t.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


Nov 19 '05 #3

P: n/a

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" <Ch***@discussions.microsoft.com> wrote in message
news:88**********************************@microsof t.com...
I would think it's the popup variable in the javascript

"Kumar Reddi" wrote:
Well, which is the line 14

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

"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:2A**********************************@microsof t.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


Nov 19 '05 #4

P: n/a
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)
"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:2A**********************************@microsof t.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
Nov 19 '05 #5

P: n/a
That's exactly waht I taught. I will give this a try.

"bruce barker" wrote:
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)
"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:2A**********************************@microsof t.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

Nov 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.