bethany
Junior Member
Posts: 2
Registered: 3/6/2003
Member Is Offline
|
| posted on 3/6/2003 at 12:06 PM |
|
|
No target control specified
Hi, I am getting the error "...No target control specified" when using the calender. If I comment the lines out that include the error
messages, the calendar works fine. Does this affect how the calender works? I
|
|
|
nik
Posts:
Registered: 1/1/1970
Member Is Offline
|
| posted on 3/6/2003 at 02:06 PM |
|
|
If it is possible, please, show code fragment where calendar is initialized and form with its pop-up call.
|
|
|
bethany
Junior Member
Posts: 2
Registered: 3/6/2003
Member Is Offline
|
| posted on 3/6/2003 at 03:52 PM |
|
|
No target control specified
Hi.
The code below is where the calender is created after the form tag
</FORM>
<script language="JavaScript">
<!--
var cal1 = new calendar1(document.forms['0'].elements['txtSurveyDate']);
cal1.year_scroll = true;
cal1.time_comp = false;
//there are numerous calenders created here but I have only included one. //-->
</script>
</BODY>
Below is the code where the calender is called in my page.
<input type="Text" name="txtSurveyDate" value="">
<a href="javascript:cal1.popup();">
<img src="../Calender/img/cal.gif" width="16" height="16" border="0" alt="Click here for the
date">
</a>
The format of the application is fairly strange so if you can't help it doesn't matter as I will leave it as it is.
Thanks for you help
|
|
|
nik
Posts:
Registered: 1/1/1970
Member Is Offline
|
| posted on 3/7/2003 at 07:42 AM |
|
|
That message appears only if there is no form or no input field referred to by initialization. Show, please, form fragment too.
|
|
|
tigra
Administrator
Posts: 1920
Registered: 6/17/2002
Location: US, CO
Member Is Offline
|
| posted on 3/7/2003 at 08:10 AM |
|
|
possible cause is the way you refer the form:
document.forms['0'] means form with name="0"
if you need to refer first form of the document then you should write document.forms[0]
|
|
|
Doyen
Newbie
Posts: 1
Registered: 10/2/2006
Location: Atlanta, GA
Member Is Offline
|
| posted on 10/2/2006 at 02:25 PM |
|
|
I figured out the reason for this error... at least in my case.
| Code: |
<script language="JavaScript">
<!-- // create calendar object(s) just after form tag closed
// specify form element as the only parameter (document.forms['formname'].elements['inputname']);
// note: you can have as many calendar objects as you need for your application
var cal6 = new calendar2(document.forms['tstest'].elements['input6']);
cal6.year_scroll = false;
cal6.time_comp = false;
var cal7 = new calendar2(document.forms['tstest'].elements['input7']);
cal7.year_scroll = true;
cal7.time_comp = true;
var cal8 = new calendar2(document.forms['tstest'].elements['input8']);
cal8.year_scroll = false;
cal8.time_comp = true;
//-->
</script>
|
which ever calendar types you use, you need to remove all the others from the script. I left the lines related to cal7 and cal8 in my script (see
above) so I got 2 'No target control specified' errors each time I loaded the page.
After removing those lines, my page loaded properly.
The error was caused in my case because there was no element named input7 or input8 in my form.
|
|
|