G
Guest
Hi,
I am trying to create a popup calender so a user can click on a button on
the main form, a calender will then popup, the user will select a date and
then click ok on the popup. The date will then be passed back to the main
form and populate a textbox. I tried two options. None worked.
First. I used the popup calender form the time tracker starter kit. On my
page I have an image buton. In the click event I have the foll code
btnFrom.Attributes.Add("onclick", "OpenCalendar('txtfrom', true);")
In the <HEAD> section of the form I have the foll
<script language="javascript" src="script.js" type="text/javascript"></script>
This is the javascript
var popUp;
function OpenCalendar(idname, postBack)
{
popUp = window.open('testCal.aspx?formname=' + document.forms[0].name +
'&id=' + idname + '&selected=' + document.forms[0].elements[idname].value
+ '&postBack=' + postBack,
'popupcal',
'width=165,height=208,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,'');
}
I get the foll error when I try to load the popup form the button click
"A runtime error has occured.
Do you wish to debug?
Line 5
Error: 'document.forms(0).elements[...].value' is null or not an object.
Second OPTION
I created a form called main with an image button and placed the foll code
on load
btn1.Attributes.Add("onclick", "var strReturn;
strReturn=window.showModalDialog('popup.aspx',null,'status:no;dialogWidth:250px;dialogHeight:225px;dialogHide:true;help:no;scroll:no');if
(strReturn != null) document.getElementById('txtStartDate').value=strReturn;")
This popups up form with a calender. It pops up fine, however, when you
click on a date or anything it pops up another page
with javascript:__doPostBack('calDate','1809') in the address bar and 'page
not found' in the body.
Any ideas?
I am trying to create a popup calender so a user can click on a button on
the main form, a calender will then popup, the user will select a date and
then click ok on the popup. The date will then be passed back to the main
form and populate a textbox. I tried two options. None worked.
First. I used the popup calender form the time tracker starter kit. On my
page I have an image buton. In the click event I have the foll code
btnFrom.Attributes.Add("onclick", "OpenCalendar('txtfrom', true);")
In the <HEAD> section of the form I have the foll
<script language="javascript" src="script.js" type="text/javascript"></script>
This is the javascript
var popUp;
function OpenCalendar(idname, postBack)
{
popUp = window.open('testCal.aspx?formname=' + document.forms[0].name +
'&id=' + idname + '&selected=' + document.forms[0].elements[idname].value
+ '&postBack=' + postBack,
'popupcal',
'width=165,height=208,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,'');
}
I get the foll error when I try to load the popup form the button click
"A runtime error has occured.
Do you wish to debug?
Line 5
Error: 'document.forms(0).elements[...].value' is null or not an object.
Second OPTION
I created a form called main with an image button and placed the foll code
on load
btn1.Attributes.Add("onclick", "var strReturn;
strReturn=window.showModalDialog('popup.aspx',null,'status:no;dialogWidth:250px;dialogHeight:225px;dialogHide:true;help:no;scroll:no');if
(strReturn != null) document.getElementById('txtStartDate').value=strReturn;")
This popups up form with a calender. It pops up fine, however, when you
click on a date or anything it pops up another page
with javascript:__doPostBack('calDate','1809') in the address bar and 'page
not found' in the body.
Any ideas?